How do I make a new-style autograd function with static forward method.?

Viewed 635

The error is :

Traceback (most recent call last):

  File "<ipython-input-5-401374f4bdee>", line 39, in <module>
    frame  = detect(frame, net.eval(), transform)

  File "<ipython-input-5-401374f4bdee>", line 14, in detect
    y = net(x)

  File "C:\Users\kusha\anaconda3\envs\virtual_platform\lib\site-packages\torch\nn\modules\module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)

  File "C:\Users\kusha\OneDrive\Desktop\Computer_Vision_A_Z_Template_Folder\Module 2 - Object Detection\ssd.py", line 101, in forward
    self.priors.type(type(x.data))                  # default boxes

  File "C:\Users\kusha\anaconda3\envs\virtual_platform\lib\site-packages\torch\autograd\function.py", line 145, in __call__
    "Legacy autograd function with non-static forward method is deprecated. "

RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)

I have tried the PyTorch documentation for autograd function stated in the error as example link but It didn't workout

0 Answers
Related