Skip to content
fn

upsample

→Tensor
upsample(input: Tensor, size: _Size = None, scale_factor: _Scale = None, mode: str = 'nearest', align_corners: bool | None = None)

Resample input to size or by scale_factor (deprecated).

Deprecated in favour of interpolate, which it calls; it warns on every call, as the reference's does.

Parameters

inputTensor
Input of shape (N, C, *spatial).
sizeint or tuple of int= None
Target spatial size.
scale_factorfloat or tuple of float= None
Multiplier for the spatial size.
modestr= 'nearest'
The resampling kernel: 'nearest', 'linear', 'bilinear', 'bicubic', 'trilinear' ... Default: 'nearest'.
align_cornersbool= None
Whether corner samples line up; see interpolate.

Returns

Tensor

The resampled tensor.

Examples

>>> import warnings
>>> import lucid
>>> from lucid.nn.functional import upsample
>>> with warnings.catch_warnings():
...     warnings.simplefilter("ignore")
...     y = upsample(lucid.randn(1, 3, 4, 4), scale_factor=2)
>>> y.shape
(1, 3, 8, 8)

Used by 1