Suppose I have a tensor of images as follows:
A=torch.rand(10, 3, 28, 28)
And suppose I have another tensor that I want to be multiplied elementwise by all images and layers of A as follows:
B=torch.rand(28, 28)
Is there an easier/faster/more efficient way to do this, instead of the following?:
B=torch.cat([torch.cat([B.unsqueeze(0)]*A.size()[-3]).unsqueeze(0)]*A.size()[-4])
C=A*B

TIA