longcw / RoIAlign.pytorch

RoIAlign & crop_and_resize for PyTorch
555 stars 103 forks source link

why can not use float64 #18

Open wu-zhonghua opened 5 years ago

wu-zhonghua commented 5 years ago

I have debugged the code for about ten years. Finally, I found cannot use dtype of the box as float64.

WHY??????????????????????????????????????????????

I think this code is a little bit stupid.

longcw commented 5 years ago

Because THFloatTensor and THCudaTensor is float32, THDoubleTensor and THCudaDoubleTensor is float64.

The type of box is defined as THFloatTensor or THCudaTensor in https://github.com/longcw/RoIAlign.pytorch/blob/master/roi_align/src/crop_and_resize.h#L3

Actually, I don't know why you need ten years to find such an error :) The proper way is to raise an exception if you are using a THDoubleTensor as the input which only accepts THFloatTensor.