How to write the einsum operation: 'i,jk->ijk' in tensorial product form?
I am using pytorch and want to broadcast a vector from 1D (features) to a 3D tensor (features×height×width) to condition the encoding of an image with a Convolutional Neural Network. As is done in Figure S1 of this Deepmind paper.
For now I am using this:
# features: 1D vector
f = torch.einsum('i,jk-&gt;ijk',features,torch.ones([5,5]))


Using broadcast semantics you could alternatively compute this using
f = features.reshape(-1, 1, 1) * torch.ones(1, 5, 5)

