If you are calling torch.Tensor (uppercase T in Tensor), you are creating an empty FloatTensor.
You could avoid this error using by defining the empty tensor as a LongTensor:
all_labels = torch.tensor([]).long()
for _ in range(5):
    all_labels = torch.cat((all_labels, torch.tensor([1])))

However, I would recommend to store the labels in a plain list and then convert it to a tensor afterwards, which should be faster than your current approach.