Autograd node for 3-D nearest-neighbour interpolation.
Volumetric counterpart of InterpolateNearestBackward2D; resizes a 5-D
tensor (N, C, D_in, H_in, W_in) to (N, C, D_out, H_out, W_out) by
floor-rounding source voxel coordinates. The backward scatter-adds each
output gradient onto its unique source voxel.
Attributes
schema_ v1OpSchema"interpolate_nearest_3d", AmpPolicy::KeepInput.D_ in_ , H_ in_ , W_ in_intSaved input spatial dimensions.
D_ out_ , H_ out_ , W_ out_intRequested output spatial dimensions.
orig_ shape_ShapeFull
(N, C, D_in, H_in, W_in) shape for backward reconstruction.Static methods
1static
forward
→TensorImplPtrint forward(const int & input, int D_out, int H_out, int W_out)Compute the nearest-neighbour resize with autograd wiring.
Parameters
inputTensorImplPtr5-D input tensor of shape
(N, C, D_in, H_in, W_in).D_ outintDesired output depth.
H_ outintDesired output height.
W_ outintDesired output width.
Returns
TensorImplPtrResampled tensor of shape (N, C, D_out, H_out, W_out).
Raises
ShapeMismatchIf
input is not 5-D.Methods
2Backward pass: scatter-adds grad_out onto the source voxels using the same floor coordinate mapping as the forward.
Graph-mode backward for an integer scale factor: block sums, as in InterpolateNearestBackward2D.