nabu.cuda.padding module

class nabu.cuda.padding.CudaPadding(shape, pad_width, mode='constant', cuda_options=None, **kwargs)[source]

Bases: PaddingBase

A class for performing padding on GPU using Cuda

Initialize a Padding object.

Parameters:
  • shape (tuple) – Image shape

  • pad_width (tuple) – Padding width for each axis. Please see the documentation of numpy.pad().

  • mode (str) – Padding mode

  • constant_values (tuple) – Tuple containing the values to fill when mode=”constant” (as in numpy.pad)

pad(image, output=None)[source]

Pad an array.

Parameters:
  • image (pycuda.gpuarray.GPUArray) – Image to pad

  • output (pycuda.gpuarray.GPUArray, optional) – Output image. If provided, must be in the expected shape.