Reciprocal is not implemented for type torch.cuda.LongTensor

Hi, when I try to compile Faster rcnn I met this problem.

the compiler tells: reciprocal is not implemented for type torch.cuda.LongTensor? how can i solve this problem??

linux:16.04
pytorch:version 0.4.0

when i try to google this problem. this post tells me i should change the pytorch version to 0.3.0, however i do not want degrade my cuda and pytorch version. thanks~

another method to sove this problem is try to convert the long tensor to float tensor, however when i convert the long tensor to float tensor another problem occurs.

1 Like

Either use .item() to get a python int or .float() to make it a float tensor.

Best regards

Thomas

i have use the .float() to convert long tensor to float tensor, however another problem occurs. if this is the right way, maybe i should try to solve another problem

just use .item(). downgrade isn’t the solution.

reciprocal isn’t and won’t be implemented on integral tensors due to obvious reasons.