You should use it on the tensor having only one dimension (check the shape of longer and shorter) and also make sure these shapes “make sense”, i.e. you really want to unsqueeze and broadcast the operation.