Exception is Expected object of scalar type Float but got scalar type Long for argument #2 'other'

Hi,
Got this error but I don’t have the full log.

def encode(words):
    max_l = max([len(i) for i in words])
    result = torch.empty((1,max_l, 26)).int()
    for word in words:
        ints = (np.fromstring(word,dtype=np.uint8)-ord('a'))
        addition = np.zeros((max_l - ints.shape[0],)) -1
        tr = torch.Tensor(np.expand_dims(np.hstack((ints,addition)),-1))
        tr = (tr[:] == torch.arange(26)).int()
        tr = torch.unsqueeze(tr, 0)
        result = torch.cat((result,tr))
    result = result[1::]
    return result

I have no Idea why this error occurs. could anybody help?