I have a scalar a and a matrix b. I want to perform a simple multiplication of the matrix by a scalar, but it seems it doesn’t work.
I also tried result = a*b.expand_as(a). This fails if a is zero, which in my case, it can be. Any ideas?
EDIT: my tensor are :
torch.Size([1])
torch.Size([4, 6, 28, 28])

EDIT2, nevermind, it’s the other way around b*a.expand_as(b) , where b is the matrix and a is the scalar.