Solved by albanD in post #4 
              
              
                If what you expect is a 5x4 tensor, with these a and b, you need to do: 
torch.cat([a.unsqueeze(-1), b], 1) (EDITED: stack -> cat). so that stack works with a tensor of size 5x1 and one of size 5x3 and concatenate them along the 1th dimension to get a 5x4 tensor.