resizes a matrix of size c0×n0 to be size c0×n.


resizes a tensor of dimensions c0×h0×w0 to be size c0×h×w.

Details and Options

  • ResizeLayer treats the first dimension as a channel dimension, which remains unchanged.
  • ResizeLayer performs linear interpolation if there is one remaining dimension and bilinear interpolation if there are two remaining dimensions.
  • In ResizeLayer[{d1,,dn}], any of the di can be one of the following:
  • nscale dimension to be size n
    Scaled[r]scale dimension to be a ratio r of the original size
    Allleave the dimension unchanged
  • ResizeLayer[][input] explicitly computes the output from applying the layer.
  • ResizeLayer[][{input1,input2,}] explicitly computes outputs for each of the inputi.
  • ResizeLayer is typically used inside NetChain, NetGraph, etc.
  • ResizeLayer exposes the following ports for use in NetGraph etc.:
  • "Input"a tensor
    "Output"a tensor of the same rank as the input
  • When it cannot be inferred from other layers in a larger net, the option "Input"{d1,,dn} can be used to fix the input of ResizeLayer to be a tensor of dimensions d1××dn.


open allclose all

Basic Examples  (2)

Create a ResizeLayer that resizes a 3-tensor to be of size c×8×8.

Click for copyable input

Create a ResizeLayer that resizes a matrix to be of size c×2.

Click for copyable input

Apply the layer to an input matrix (where c is 1):

Click for copyable input

Scope  (2)

See Also

ImageResize  SpatialTransformationLayer  ReshapeLayer  FlattenLayer  NetChain  NetGraph

Introduced in 2017