trw.transforms.pad

Module Contents

Functions

transform_batch_pad_numpy(array, padding, mode='edge', constant_value=0)

Add padding on a numpy array of samples. This works for an arbitrary number of dimensions

transform_batch_pad_torch(array, padding, mode='edge', constant_value=0)

Add padding on a numpy array of samples. This works for an arbitrary number of dimensions

transform_batch_pad(array, padding, mode='edge', constant_value=0)

Add padding on a numpy array of samples. This works for an arbitrary number of dimensions

transform_batch_pad_joint(arrays, padding, mode='edge', constant_value=0)

Add padding on a list of numpy or tensor array of samples. Supports arbitrary number of dimensions

trw.transforms.pad.transform_batch_pad_numpy(array, padding, mode='edge', constant_value=0)

Add padding on a numpy array of samples. This works for an arbitrary number of dimensions

Parameters
  • array – a numpy array. Samples are stored in the first dimension

  • padding – a sequence of size len(array.shape)-1 indicating the width of the padding to be added at the beginning and at the end of each dimension (except for dimension 0)

  • modenumpy.pad mode

Returns

a padded array

trw.transforms.pad.transform_batch_pad_torch(array, padding, mode='edge', constant_value=0)

Add padding on a numpy array of samples. This works for an arbitrary number of dimensions

This function mimics the API of transform_batch_pad_numpy so they can be easily interchanged.

Parameters
  • array – a Torch array. Samples are stored in the first dimension

  • padding – a sequence of size len(array.shape)-1 indicating the width of the padding to be added at the beginning and at the end of each dimension (except for dimension 0)

  • modenumpy.pad mode. Currently supported are (‘constant’, ‘edge’, ‘symmetric’)

Returns

a padded array

trw.transforms.pad.transform_batch_pad(array, padding, mode='edge', constant_value=0)

Add padding on a numpy array of samples. This works for an arbitrary number of dimensions

Parameters
  • array – a numpy array. Samples are stored in the first dimension

  • padding – a sequence of size len(array.shape)-1 indicating the width of the padding to be added at the beginning and at the end of each dimension (except for dimension 0)

  • modenumpy.pad mode

Returns

a padded array

trw.transforms.pad.transform_batch_pad_joint(arrays, padding, mode='edge', constant_value=0)

Add padding on a list of numpy or tensor array of samples. Supports arbitrary number of dimensions

Parameters
  • arrays – a numpy array. Samples are stored in the first dimension

  • padding – a sequence of size len(array.shape)-1 indicating the width of the padding to be added at the beginning and at the end of each dimension (except for dimension 0)

  • modenumpy.pad mode

Returns

a list of padded arrays