ssd-pytorch icon indicating copy to clipboard operation
ssd-pytorch copied to clipboard

RuntimeError: Legacy autograd function with non-static forward method is deprecated.

Open Simonhancrew opened this issue 4 years ago • 4 comments

环境问题

torch>=1.3

predict.py会报错

RuntimeError: Legacy autograd function with non-static forward method is deprecated.

在pytorch1.3及以后的版本需要规定forward方法为静态方法,对此修改以下片段就能work before

if self.phase == "test":
  output = self.detect.forward(
      loc.view(loc.size(0), -1, 4),
      self.softmax(conf.view(conf.size(0), -1, self.num_classes)),
      self.priors              
  )

after

if self.phase == "test":
    output = self.detect.forward(
        loc.view(loc.size(0), -1, 4),
        self.softmax(conf.view(conf.size(0), -1, self.num_classes)),
        self.priors              
    )

Simonhancrew avatar Oct 09 '21 08:10 Simonhancrew

更新后还有吗……,我已经改了这段了

bubbliiiing avatar Oct 13 '21 15:10 bubbliiiing

更新后还有吗……,我已经改了这段了

母鸡啊,我没用过更新的。看doc自己改完解决了

Simonhancrew avatar Oct 13 '21 15:10 Simonhancrew

好的解决了就好,可以看看新库

bubbliiiing avatar Oct 13 '21 15:10 bubbliiiing

好的解决了就好,可以看看新库

感谢你的implement

Simonhancrew avatar Oct 13 '21 16:10 Simonhancrew