Skip to main content

Upsample

Upsample(size=None, scale_factor=None, mode="nearest", align_corners=None, recompute_scale_factor=False, antialias=False)

Resamples the spatial dimensions to size or by scale_factor (exactly one given); the input is channels-last and its rank picks the spatial variant. The two settings share one type, so the module is constructed from its options: Upsample(UpsampleOptions().scale_factor({2, 2})).

The module form of clika_runtime.nn.functional.interpolate: construct it once with the settings, then call it like a function.

Args: size: the target spatial extents; each entry an integer or a 0-D tensor; None takes the function's own default. scale_factor: the multiplier per spatial dimension; each entry a number or a 0-D tensor; None takes the function's own default. mode: the interpolation mode. align_corners: aligns the corner samples of input and output for the linear modes; None takes the function's own default. recompute_scale_factor: derives the effective scale from the computed output size. antialias: low-pass filters when downsampling.

__init__​

__init__(self, size: 'Sequence[Tensor | float | int] | None' = None, scale_factor: 'Sequence[Tensor | float | int] | None' = None, mode: '_InterpMode' = 'nearest', align_corners: 'bool | None' = None, recompute_scale_factor: 'bool' = False, antialias: 'bool' = False) -> 'None'

Initialize self. See help(type(self)) for accurate signature.

extra_repr​

extra_repr(self) -> 'str'

extra_repr() -> str

One line of per-class detail for :meth:__repr__; a layer prints its geometry here (in_features=64, out_features=256).

forward​

forward(self, input: 'Tensor') -> 'Tensor'

forward(input) -> Tensor

Runs clika_runtime.nn.functional.interpolate on input with the stored settings; returns a new tensor.