nabu.processing.padding_opencl module

class nabu.processing.padding_opencl.OpenCLPadding(shape, pad_width, mode='constant', opencl_options=None, **kwargs)[source]

Bases: PaddingBase

A class for performing padding on GPU using OpenCL

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)

backend = 'opencl'
pad(image, output=None)[source]

Pad an array.

Parameters:
  • image (pyopencl array) – Image to pad

  • output (pyopencl array) – Output image. If provided, must be in the expected shape.