But it’s sort of hard to see in your example because you are multiplying everything by ones. You can open a REPL. I also think with pytorch 1.3 you could use named tensors and just make sure that a's dimensions are named something like N, C, H and b's dimensions are H, W… basically just ensure that the dimensions align correctly.