pyiqa.matlab_utils.padding

Module Contents

pyiqa.matlab_utils.padding.to_1tuple[source]
pyiqa.matlab_utils.padding.to_2tuple[source]
pyiqa.matlab_utils.padding.to_3tuple[source]
pyiqa.matlab_utils.padding.to_4tuple[source]
pyiqa.matlab_utils.padding.to_ntuple[source]
pyiqa.matlab_utils.padding.symm_pad(im: torch.Tensor, padding: Tuple[int, int, int, int])[source]

Symmetric padding same as tensorflow. Ref: https://discuss.pytorch.org/t/symmetric-padding/19866/3

pyiqa.matlab_utils.padding.exact_padding_2d(x, kernel, stride=1, dilation=1, mode='same')[source]
class pyiqa.matlab_utils.padding.ExactPadding2d(kernel, stride=1, dilation=1, mode='same')[source]

Bases: torch.nn.Module

This function calculate exact padding values for 4D tensor inputs, and support the same padding mode as tensorflow.

Parameters:
  • kernel (int or tuple) – kernel size.

  • stride (int or tuple) – stride size.

  • dilation (int or tuple) – dilation size, default with 1.

  • mode (srt) – padding mode can be (‘same’, ‘symmetric’, ‘replicate’, ‘circular’)

forward(x)[source]