Hi there,

I’m new to PyTorch (and deep learning) and I need to do a computation that’s not straight forward (to me) to do with provided functions.

It would be easy to do using “for” but clearly I should avoid that.

The computation is:

For tensor A of dimension (20, 40, 256) and tensor B of dimension (20, 40, 256X300) do an “almost convolution” that results in a tensor C of dimension (20, 40, 300).

Here “almost convolution” means that for each element in the feature map of dim [20, 40] the convolution is done for channels, so the 256 channels from A get filtered through the 300 filters of 256 channels. But at the end, instead of adding all of the results to get a (1,1,300) tensor, the results stay separate for each of the (20,40) elements of the feature maps to get a (20, 40, 300) tensor.

Backpropagation should also work when this computation is part of the computation of the loss function.