Solved by ptrblck in post #2 
              
              
                The error is raised due to a mismatch in the number of dimensions. 
New dimensions would be added to the front of the expanded tensor, so you would have to unsqueeze the missing last dimensions: 
bias = torch.randn([1104]) 
result = torch.randn([1,1104,15,20])
bias[None, :, None, None].expand_as(res…