What it does
Resize makes a tensor larger (or smaller) by computing each output pixel from nearby input pixels: copying the nearest one, or blending neighbors linearly or cubically. It has no learned parameters, so it cannot invent detail, but followed by a convolution it is a common replacement for transposed convolution because it avoids checkerboard artifacts. Decoders, feature pyramids and depth or matting heads use it to bring coarse predictions back to full resolution.
Formula
nearest: Y[y, x] = X[⌊y / s⌋, ⌊x / s⌋]bilinear: Y = Σ over the 4 nearest inputs of (1 − |Δy|)(1 − |Δx|) · XShapes and parameters
- Shapes
- Input [N, C, H, W] and a scale per axis (or target sizes); output [N, C, s·H, s·W].
- Parameters
- None.
- Used for
- U-Net and U²-Net decoders, feature pyramids in detectors, depth estimation and portrait matting heads, style transfer upsampling layers.
In WeightSpace
Read-only in WeightSpace today.
Where it appears
- Find what stands out in a photoU²-Net-p381.1M params
- Segment an object by clickingSlimSAM229.7M params
- Separate a person from the backgroundPP-HumanSeg141.5M params
- Cut out a portraitMODNet96.5M params
- Generate a frame between two photosPractical-RIFE 4.2585.7M params
- Track body joints in a photoMediaPipe BlazePose74.3M params
- Estimate depth from a photoDepth Anything V2 Small625M params
- Find text regions on an imagePP-OCRv5 Mobile Detection61.2M params
- Read a phrase aloudKokoro 82M681M params
- Detect objects in a photoNanoDet-Plus4942K params
- Find rows and cells in a tablePaddleOCR SLANet+31.9M params
- Locate faces and facial landmarksYuNet253K params
- Read a facial expressionOpenCV Zoo MobileFaceNet21.2M params
- Track fingertips in a photoMediaPipe Hand Landmarker22.0M params
- Turn a photo into a mosaicFast Neural Style Mosaic21.7M params
- Track motion between two framesRAFT-Small1990K params