trw.layers.crop_or_pad
¶
Module Contents¶
Functions¶
|
Crop or pad a tensor to the specified shape ( |
- 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
andC
excluded)- Parameters
x – the tensor shape
shape – the shape of x to be returned.
N
andC
channels must not be specifiedpadding_default_value – the padding value to be used
- Returns
torch.Tensor