# ResizeLayer

ResizeLayer[{n}]

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

ResizeLayer[{h,w}]

resizes an array 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:
•  n scale dimension to be size n Scaled[r] scale dimension to be a ratio r of the original size All leave the dimension unchanged
• ResizeLayer[][input] explicitly computes the output from applying the layer.
• ResizeLayer[][{input1,input2,}] explicitly computes outputs for each of the inputi.
• When given a NumericArray as input, the output will be a NumericArray.
• ResizeLayer is typically used inside NetChain, NetGraph, etc.
• ResizeLayer exposes the following ports for use in NetGraph etc.:
•  "Input" an array "Output" an array of the same rank as the input
• The following optional parameters can be included:
•  Resampling Automatic resampling method
• Possible explicit settings for the Resampling method include:
•  "Linear" piecewise linear interpolation "Nearest" nearest neighbor
• When the Resampling method is "Nearest", only the special cases of ResizeLayer[{Scaled[n]}] and ResizeLayer[{Scaled[n],Scaled[n]}], where n is a positive integer, are currently implemented.
• 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 an array of dimensions d1××dn.
• Options[ResizeLayer] gives the list of default options to construct the layer. Options[ResizeLayer[]] gives the list of default options to evaluate the layer on some data.
• Information[ResizeLayer[]] gives a report about the layer.
• Information[ResizeLayer[],prop] gives the value of the property prop of ResizeLayer[]. Possible properties are the same as for NetGraph.

# Examples

open allclose all

## Basic Examples(2)

Create a ResizeLayer that resizes a three-dimensional array to be of size c×8×8:

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

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

## Scope(2)

Create a ResizeLayer that resizes a three-dimensional array to be a specific size:

Apply the layer to an input:

Plot the result:

Construct a ResizeLayer that preserves the height and multiplies the width of an input image by 1.5:

Apply the layer to an image:

Thread the layer across a batch of images: