ResizeLayer [{d}]
represents a layer performing one-dimensional resizing of a two-dimensional array.
ResizeLayer [{d1,…,dn}]
represents a layer performing n-dimensional resizing of a (n+1)-dimensional array.
ResizeLayer
ResizeLayer [{d}]
represents a layer performing one-dimensional resizing of a two-dimensional array.
ResizeLayer [{d1,…,dn}]
represents a layer performing n-dimensional resizing of a (n+1)-dimensional array.
Details and Options
- ResizeLayer is typically used inside NetChain , NetGraph , etc. to resize one or several dimensions of input arrays by resampling.
- By default or with the setting Interleaving False , ResizeLayer treats the first dimension as a channel dimension, which remains unchanged. With the setting Interleaving True , the channel dimension is taken to be the last dimension of the input and output arrays.
- In ResizeLayer [{d1,…,dn}], any of the di can be one of the following:
-
n scale dimension to be size nAll leave the dimension unchanged
- The following optional parameters can be included:
-
"Scheme" Automatic resampling scheme
- Possible explicit settings for the Resampling method include:
-
"Linear" piecewise linear interpolation"Nearest" nearest neighbor
- Possible explicit settings for the "Scheme" parameter include:
-
Automatic automatic choice depending on the method"Point" point sampling"Bin" bin sampling
- Settings for the "Scheme" parameter have the same meaning as those in the third argument of ArrayResample .
- The automatic choice for the "Scheme" parameter selects "Point" when Resampling is set to "Linear" and "Bin" when Resampling is set to "Nearest".
- When the Resampling method is "Nearest", only the special cases of ResizeLayer [{Scaled [m],Scaled [n],…}], where m, n, ... are positive integers, are currently implemented.
- ResizeLayer exposes the following ports:
-
"Input" an array"Output" an array of the same rank as the input
- 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 .
- 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 all close allBasic 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)
Arguments (1)
Create a ResizeLayer that resizes a three-dimensional array to be a specific size:
Apply the layer to an input:
Plot the result:
Ports (1)
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:
Options (2)
Interleaving (1)
Create a ResizeLayer with Interleaving False and one input channel:
Create a ResizeLayer with Interleaving True and one input channel:
Resampling (1)
Upsample an array by a factor of 3 using linear interpolation:
Upsample an array with a factor of 3 using nearest-neighbor interpolation:
Tech Notes
Related Guides
Text
Wolfram Research (2017), ResizeLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/ResizeLayer.html (updated 2021).
CMS
Wolfram Language. 2017. "ResizeLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ResizeLayer.html.
APA
Wolfram Language. (2017). ResizeLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ResizeLayer.html
BibTeX
@misc{reference.wolfram_2025_resizelayer, author="Wolfram Research", title="{ResizeLayer}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ResizeLayer.html}", note=[Accessed: 16-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_resizelayer, organization={Wolfram Research}, title={ResizeLayer}, year={2021}, url={https://reference.wolfram.com/language/ref/ResizeLayer.html}, note=[Accessed: 16-November-2025]}