Autograd node for 3-D trilinear interpolation.
Resizes a 5-D tensor of shape (N, C, D_in, H_in, W_in) to
(N, C, D_out, H_out, W_out) by linearly interpolating between the
eight neighbouring input voxels. Conceptually the trilinear weights are
the product of three 1-D linear weights (one per spatial axis), giving
where the per-axis source coordinates follow the same align_corners rule
described in the file header.
Math
Output size formula (per axis ):
Attributes
schema_ v1OpSchema"interpolate_trilinear", AmpPolicy::Promote.D_ in_ , H_ in_ , W_ in_intD_ out_ , H_ out_ , W_ out_intalign_ corners_boolorig_ shape_Shape(N, C, D_in, H_in, W_in) shape for backward reconstruction.Static methods
1forward
→TensorImplPtrint forward(const int & input, int D_out, int H_out, int W_out, bool align_corners)Compute the trilinear resize with autograd wiring.
Parameters
inputTensorImplPtr(N, C, D_in, H_in, W_in).D_ outintH_ outintW_ outintalign_ cornersboolReturns
TensorImplPtrResampled tensor of shape (N, C, D_out, H_out, W_out).
Raises
ShapeMismatchinput is not 5-D.Methods
2Backward pass: scatters grad_out to source voxels using the same trilinear weights as the forward.
Graph-mode backward: one matmul per axis against the 1-D resampling matrices, so it can be differentiated again.