3d convolution for CIFAR

Hello ,
Could anyone provide me with a simple code of 3D conv on CIFAR datasets using pytorch. Thank you in advance.

Could you explain your use case a bit? The CIFAR dataset yields images, so how would you like to stack these images into volumes?

1 Like

i want to use 3d convolution on 2d input images, on any datasets , just want to learn more from codes, its easy for me.
More precisely, i want to apply a 3d kernel on inputs(h,w,c),l mean, each channel need to be convolved with kernel not all with same kernel. i.e : my datasets has 100x100x5 , wanna apply kernel size of 5 channels , not the sum of these 5 kernels as the 2D conv really is.just to preserve the same depth of the image during the convolution.
I hope that makes sense.

Based on the description, it sounds like you would like to apply a depthwise convolution, in which case you could use nn.Conv2d with groups=in_channels.

1 Like

yeah it is. that’s what i meant. could you help me how should i do it on CIFAr , if possible.

Depthwise convolutions are not dependent on your dataset, so you could simply set groups=in_channels in each conv layer.

There is a great reference for understanding Different kinds of Convolution Operators (3D Convolution, Spatially separable convolution, depthwise separable convolution, etc.):

Thanks for sharing , I appreciate