Solved by KFrank in post #2 
              
              
                Hi Chichi! 
The short answer is pytorch’s broadcasting. 

The arguments to max() have the following shapes: 
tensor_1[:, None, :1].shape = torch.Size([5, 1, 1])
tensor_2[:, :1].shape =  torch.Size([4, 1])

When broadcast, the two trailing 1s line up, the middle 1 of the first 
argument gets broadcas…