This should provide you sufficient info to you help debug this issue.Input size(1,3,224,224)
Module class
!pip install efficientnet_pytorch
from efficientnet_pytorch import EfficientNet
model = EfficientNet.from_pretrained(‘efficientnet-b5’, num_classes=5)
class efficient(nn.Module):
def __init__(self,m):
super().__init__()
l=nn.Sequential()
fc=nn.Sequential()
l.add_module('conv_stem',m._conv_stem)
l.add_module('_bn0',m._bn0)
l.add_module('_blocks',m._blocks)
l.add_module('_conv_head',m._conv_head)
self.add_module('feature',l)
fc.add_module('_bn1',m._bn1)
fc.add_module('_fc',m._fc)
self.add_module('fc',fc)
def forward(self, x):
x1=self.feature(x)
x1= self.fc(x1)
#x1=self._blocks(x1)
#x1=self._conv_head(x1)
#x1=self._bn1(x1)
#x = x.view(x.size(0), -1)
#x=self.l1(x)
# x = self.x_unet(x, self.sfs[0].features)
#x1 = self.fc(x)
return x1
m=efficient(model)
m(x)
Gives Not implemented error
result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)
/opt/conda/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
/opt/conda/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)
/opt/conda/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
/opt/conda/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)
/opt/conda/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