Solved by Nikronic in post #2 
              
              
                Hi, 
You just need to change the view of b to match in dimensions: 
a[0,:,:,:]=b.view(-1, 1, 1)

It’s about Broadcasting semantics — PyTorch 1.7.0 documentation which has some criteria. 
Bests