Say you had a 3D tensor (batch size = 1):
a = torch.rand(1,3,6,6)
and you wanted to smooth that tensor along the channel axis (i.e. axis 1), with a Gaussian kernel, without smoothing along the 2nd and 3rd axes, how would one do this?
However, this is a 3D tensor so I assume you would have to create your kernel as a 3D Gaussian where 2 of the axes are simply ones while the third follows a Gaussian function.
Could someone please show me how to do this correctly within a network (this is an assumption that the innit function contains convolutional layers being instantiated in the following way as
self.conv0 = torch.nn.Conv2d(120,16,3,1,padding=1)
self.conv1 = torch.nn.Conv2d(16,32,3,1,padding=1)
etc. and that you would like to perform this convolution as part of the forward procedure in the network).
Many thanks in advance for help on this!
Edit for clarity: like in this post, my initial attempts to do this involved modifying the kernel to look as follows:
self.kernel = torch.FloatTensor([[[0.006, 0.061, 0.242, 0.383, 0.242, 0.061, 0.006], [1., 1., 1., 1., 1., 1., 1.], [1., 1., 1., 1., 1., 1., 1.]]])