-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
NotImplementedError when use forward function. #38
Comments
What version of PyTorch are you using? |
Hi, my PyTorch version is 1.1.0. |
Thanks for the quick reply. I've replicated your issue and I agree it's odd. For now, you can use I agree that at the moment, this is a little hackier than I would like. |
Hi, Thanks for your kind reply. However, I meet a problem when enter the link above. Notebook loading error |
Sorry about that, try this: |
It solves my problem. Thank you very much. :) |
Happy to help! |
Is there an actual solution for this? |
@lukemelas your solution doesn't seem to run correctly anymore. It got: |
I delete Now EfficientNet-PyTorch/efficientnet_pytorch/model.py Lines 156 to 172 in bd3c392
|
@lukemelas If the above comment is correct, I'm glad if you update Colaboratory code https://colab.research.google.com/drive/1C2vRryOEA95wOLmc56LhF6l1EwM-MeBf |
Done! :) |
thanks for your answer, but it seems that extract_features is a function not in module, so we can't modify the parameters in these networks, right? |
Can this colab notebook be made available again? I am experiencing the same issue as OP |
seems the colab notebook is not available,i am facing the same issue |
I try define a model based on pretrained EfficientNet as below. But I get a NotImplementedError: when use 'forward' function. However, when I use other pretrained CNN e.g., resnet18 from torchvision, there is no such problem. Can anyone help me? Thanks a lot
'Model definition'
class EfficientNet_scene(nn.Module):
net = EfficientNet_scene()
image = torch.randn(1,3,224,224)
b = net(image)
Error information:
NotImplementedError Traceback (most recent call last)
in ()
37 print(net)
38 image = torch.randn(1,3,224,224)
---> 39 b = net(image)
40 print(b)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)
in forward(self, x)
30
31 def forward(self,x):
---> 32 x = self.features(x)
33 x = x.reshape(x.size(0), -1)
34 x = self.fc(x)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/container.py in forward(self, input)
90 def forward(self, input):
91 for module in self._modules.values():
---> 92 input = module(input)
93 return input
94
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in forward(self, *input)
86 registered hooks while the latter silently ignores them.
87 """
---> 88 raise NotImplementedError
89
90 def register_buffer(self, name, tensor):
NotImplementedError:
The text was updated successfully, but these errors were encountered: