import torch a = torch.tensor([[1], [2], [3]]) # shape (3, 1) b = torch.tensor([[10, 20, 30, 40]]) # shape (1, 4) c = a + b print(c.shape) print(c)