nabu.processing.convolution_cuda module

class nabu.processing.convolution_cuda.Convolution(shape, kernel, axes=None, mode=None, extra_options=None, cuda_options=None)[source]

Bases: object

A class for performing convolution on GPU with CUDA, but without using textures (unlike for example in silx.opencl.convolution)

Constructor of Cuda Convolution.

Parameters:
  • shape (tuple) – Shape of the array.

  • kernel (array-like) – Convolution kernel (1D, 2D or 3D).

  • axes (tuple, optional) – Axes along which the convolution is performed, for batched convolutions.

  • mode (str, optional) –

    Boundary handling mode. Available modes are:
    • ”reflect”: cba|abcd|dcb

    • ”nearest”: aaa|abcd|ddd

    • ”wrap”: bcd|abcd|abc

    • ”constant”: 000|abcd|000

    Default is “reflect”.

  • extra_options (dict, optional) –

    Advanced options (dict). Current options are:
    • ”allocate_input_array”: True

    • ”allocate_output_array”: True

    • ”allocate_tmp_array”: True

    • ”sourcemodule_kwargs”: {}

    • ”batch_along_flat_dims”: True

convolve(array, output=None)[source]

Convolve an array with the class kernel.

Parameters:
  • array – Input array. Can be numpy.ndarray or pycuda.gpuarray.GPUArray.

  • output – Output array. Can be numpy.ndarray or pycuda.gpuarray.GPUArray.