trw.layers.crop_or_pad

Module Contents

Functions

crop_or_pad_fun(x: torch.Tensor, shape: Sequence[int], padding_default_value=0) → torch.Tensor

Crop or pad a tensor to the specified shape (N and C excluded)

trw.layers.crop_or_pad.crop_or_pad_fun(x: torch.Tensor, shape: Sequence[int], padding_default_value=0) torch.Tensor

Crop or pad a tensor to the specified shape (N and C excluded)

Parameters
  • x – the tensor shape

  • shape – the shape of x to be returned. N and C channels must not be specified

  • padding_default_value – the padding value to be used

Returns

torch.Tensor