weixin_39728320
weixin_39728320
2020-11-29 11:42

Runtime Error: expected Variable or None (got torch.FloatTensor)

Getting this error when running cost.backward() How could I fix this?

该提问来源于开源项目:meijieru/crnn.pytorch

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

19条回答

  • weixin_39917090 weixin_39917090 5月前

    My pytorch is 0.3.0,cuda8.0

    点赞 评论 复制链接分享
  • weixin_39888412 weixin_39888412 5月前

    yes ,may be you should upgrade to 4

    点赞 评论 复制链接分享
  • weixin_39917090 weixin_39917090 5月前

    Thank you so much.I have solved the problem.

    点赞 评论 复制链接分享
  • weixin_39917090 weixin_39917090 5月前

    After I run the steup.py in warp-ctc/pytorch_binding again,the problem was solved.

    点赞 评论 复制链接分享
  • weixin_39728320 weixin_39728320 5月前

    Solved: warp-ctc commit from 9 days ago made the problem: image

    Checkout to that version and then it is solved.

    点赞 评论 复制链接分享
  • weixin_39575648 weixin_39575648 5月前

    That change requires PyTorch 0.4.

    点赞 评论 复制链接分享
  • weixin_39616348 weixin_39616348 5月前

    I want know how to solve the problem,I install the warpctc_pytorch just now,change the pytorch version to 0.4 can solve the problem?

    点赞 评论 复制链接分享
  • weixin_39888412 weixin_39888412 5月前

    I have checked that my pytorch veriosn is 0.4.0,and modified the init.py in warp_ctc,still the same issue occurs.

    点赞 评论 复制链接分享
  • weixin_39575648 weixin_39575648 5月前

    You should use warp-ctc's previous commit for PyTorch 0.3

    点赞 评论 复制链接分享
  • weixin_39888412 weixin_39888412 5月前

    I have tried pytorch 0.4.0 also work well

    点赞 评论 复制链接分享
  • weixin_39917090 weixin_39917090 5月前

    I have modified the init.py in warp_ctc,still the same issue occurs.

    点赞 评论 复制链接分享
  • weixin_39888412 weixin_39888412 5月前

    you should not modified the init.py following above,you should modified as below: Line 4 :add--> from torch.autograd import Variable Line 46: delete-->#ctx.grads = grads add--> ctx.grads = Variable(grads,volatile=True)

    点赞 评论 复制链接分享
  • weixin_39917090 weixin_39917090 5月前

    I did as what you say,but it is still the same problem.After I modified as what you said,should I run the steup.py in warp-ctc/pytorch_binding?

    点赞 评论 复制链接分享
  • weixin_39728320 weixin_39728320 5月前

    image

    This is the traceback. Any clue why this could be happening?

    点赞 评论 复制链接分享
  • weixin_39575648 weixin_39575648 5月前

    Please provide enough information for such problem (like pytorch version and etc.)

    点赞 评论 复制链接分享
  • weixin_39728320 weixin_39728320 5月前

    0.3.0

    点赞 评论 复制链接分享
  • weixin_39575648 weixin_39575648 5月前

    Could not reproduce. You should provide as much information as possible, otherwise nobody could help you.

    点赞 评论 复制链接分享
  • weixin_39728320 weixin_39728320 5月前

    What other information would you like? I'm using Ubuntu 16.04, CUDA 9. Done the installation using a conda environment. Would it be possible for you to upload your conda environment as a yaml file for me to use?

    点赞 评论 复制链接分享
  • weixin_39575648 weixin_39575648 5月前

    At least the backtrace should be provided.

    点赞 评论 复制链接分享

相关推荐