Bicubic or tricubic interpolation on 3d tensors

I am wanting to standardize 3d tensors to shape (32,512,512) which is the (depth, height, width) using bicubic or tricubic mode for interpolation.

I am aware that bicubic mode is present in torch.nn.functional.interpolate as per the documentation

The modes available for resizing are: nearest, linear (3D-only), bilinear, bicubic (4D-only), trilinear (5D-only), area, nearest-exact

But its only for 4D data. Is there a way to implement with bicubic or tricubic interpolation on 3d tensors

Currently temporal, spatial and volumetric sampling are supported, i.e. expected inputs are 3-D, 4-D or 5-D in shape.

So I assume volumetric refers to a shape of [batch_size, channels, depth, height, width].

Hey @ptrblck ,
thanks for your reply but, I am unable to understand how it helps my problem.

I just want to understand if there is a way in which I can implement Bicubic transformation on 3d data points.
The current blocker I am facing is that the available bicubic transformation is present for 4d data points.

Another option is if I could add another dimension to my 3d data to make it 4d and then implement the available bicubic interpolation. But, the problem with that is if i make my data 4d then the interpolate function will add 2 more dimensions to it for batch and Num_channels which will make it 6d, which is not acceptable

Please let me know your thoughts on this


Hey @hardik_rathod,

I am having the same issue as you. Bicubic interpolation is only supported for 2D images but not 3D images. Did you end up figuring it out or did you have to write your own implementation?