You can add a tensor to another one with the + operator. Substraction is done with -. The number of elements in the tensors must match, but the sizes do not matter. The size of the returned tensor will be the size of the first tensor.

> x = torch.Tensor(2,2):fill(2)
> y = torch.Tensor(4):fill(3)
> = x+y

 5  5
 5  5
[torch.Tensor of dimension 2x2]

> = y-x

 1
 1
 1
 1
[torch.Tensor of dimension 4]

A scalar might also be added or substracted to a tensor. The scalar might be on the right or left of the operator.

> x = torch.Tensor(2,2):fill(2)
> = x+3

 5  5
 5  5
[torch.Tensor of dimension 2x2]

> = 3-x

 1  1
 1  1
[torch.Tensor of dimension 2x2]