Rate this Page

upsample#

classtorch.ao.nn.quantized.functional.upsample(input,size=None,scale_factor=None,mode='nearest',align_corners=None)[source]#

Upsamples the input to either the givensize or the givenscale_factor

Warning

This function is deprecated in favor oftorch.ao.nn.quantized.functional.interpolate().This is equivalent withnn.quantized.functional.interpolate(...).

Seetorch.nn.functional.interpolate() for implementation details.

The input dimensions are interpreted in the form:mini-batch x channels x [optional depth] x [optional height] x width.

Note

The input quantization parameters propagate to the output.

Note

Only 2D input is supported for quantized inputs

Note

Only the following modes are supported for the quantized inputs:

  • bilinear

  • nearest

Parameters
  • input (Tensor) – quantized input tensor

  • size (int orTuple[int] orTuple[int,int] orTuple[int,int,int]) – output spatial size.

  • scale_factor (float orTuple[float]) – multiplier for spatial size. Has to be an integer.

  • mode (str) – algorithm used for upsampling:'nearest' |'bilinear'

  • align_corners (bool,optional) – Geometrically, we consider the pixels of theinput and output as squares rather than points.If set toTrue, the input and output tensors are aligned by thecenter points of their corner pixels, preserving the values at the corner pixels.If set toFalse, the input and output tensors are aligned by the cornerpoints of their corner pixels, and the interpolation uses edge value paddingfor out-of-boundary values, making this operationindependent of input sizewhenscale_factor is kept the same. This only has an effect whenmodeis'bilinear'.Default:False

Warning

Withalign_corners=True, the linearly interpolating modes(bilinear) don’t proportionally align theoutput and input pixels, and thus the output values can depend on theinput size. This was the default behavior for these modes up to version0.3.1. Since then, the default behavior isalign_corners=False.SeeUpsample for concrete examples on how thisaffects the outputs.