bartorch.resize

Contents

bartorch.resize#

bartorch.resize()#

Crop or zero-pad input to oshape.

Parameters:
  • input (torch.Tensor) – Array to resize.

  • oshape (tuple of int) – Full output shape, one size per axis of input.

  • anchor ({"center", "front", "start"}, default='center') – "center" keeps index n // 2 at m // 2; "front" keeps the last element in place and crops or pads at the beginning; "start" keeps the first element and crops or pads at the end.

Returns:

The shape oshape.

Return type:

torch.Tensor

Raises:

ValueError – If oshape does not have one size of at least one per axis, or anchor is unknown.