Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: forward() missing 1 required positional argument: 'x' #598

Open
BattleOfDance opened this issue Mar 26, 2024 · 5 comments
Open

Comments

@BattleOfDance
Copy link

when i use eval.py to evaluate my model. it reports this problem. How can i solve this problem?

@BattleOfDance
Copy link
Author

this is the whole problem report
D:\PycharmProjects\ssd-master\ssd.py:34: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead.
self.priors = Variable(self.priorbox.forward(), volatile=True)
Finished loading model!
Traceback (most recent call last):
File "D:/PycharmProjects/ssd-master/eval.py", line 438, in
thresh=args.confidence_threshold)
File "D:/PycharmProjects/ssd-master/eval.py", line 385, in test_net
detections = net(x).data
File "D:\Anaconda\envs\pytorch1\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
TypeError: forward() missing 1 required positional argument: 'x'

Process finished with exit code 1

@BattleOfDance
Copy link
Author

The problem was caused by adding @staticmethod up the forward function in ssd.py classs ssd
1713015532982

@BattleOfDance
Copy link
Author

Del this ,it will report
1713015585383

@BattleOfDance
Copy link
Author

changing
1713015896827
to
1713015924696
it still report
1713015957181

@BattleOfDance
Copy link
Author

according this blog, I resolved this problem finally
https://blog.csdn.net/XiaoGShou/article/details/125253471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant