MLCVNet icon indicating copy to clipboard operation
MLCVNet copied to clipboard

RuntimeError: Expected isFloatingType(grads[i].type().scalarType()) to be true, but got false.

Open mtli77 opened this issue 4 years ago • 1 comments

Hi, here

I miss this error:

Traceback (most recent call last):
  File "train.py", line 331, in <module>
    train(start_epoch)
  File "train.py", line 316, in train
    train_one_epoch()
  File "train.py", line 234, in train_one_epoch
    loss.backward()
  File "/home/ubuntu/.conda/envs/tia37/lib/python3.7/site-packages/torch/tensor.py", line 195, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File "/home/ubuntu/.conda/envs/tia37/lib/python3.7/site-packages/torch/autograd/__init__.py", line 99, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: Expected isFloatingType(grads[i].type().scalarType()) to be true, but got false.  (Could this error message be improved?  If so, please report an enhancement request to PyTorch.)

Could you please give me some advice about this bug? Thank you!

mtli77 avatar Jan 06 '21 13:01 mtli77

The problem is solved, when PyTorch version >= 1.3.0, it is required to add mark_non_differentiable() must be used to tell the engine if an output is not differentiable. https://pytorch.org/docs/master/notes/extending.html

Solution: https://github.com/facebookresearch/votenet/commit/c330998f04ed8cae5d4d724df26bd3af1672f6b6

iamwilliamli avatar Apr 11 '21 10:04 iamwilliamli