Torch.exp(tensor) not working for cuda Long tensor

I want to compute exp() of each item of a cuda tensor
out_adj = torch.exp(out_adj) where out_adj is a 1D tensor with 60 values.
I get the error message
RuntimeError: "exp_cuda" not implemented for 'Long'

I tried to change the type of the tensor to torch.cuda.IntTensor and to torch.cuda.ShortTensor, but nothing works.
Iā€™d be happy to get help on this :wink:


The exp function is only implemented for continuous dtypes Iā€™m afraid.
You can convert your Tensor to float for example before evaluating it for it to work: out_adj = torch.exp(out_adj.float())

1 Like

Thanks a lot.
I managed to implement in multiplying out_adj * 1.0, but your proposal is by far cleaner and smarter.