thanks a lot for this clarification another question if you please the model should have two methods which are forward_feature and forward . if I need to get the features from forward_feature using the Identity layer . I tried to implement like that
> class Identity(nn. Module):
>     def __init__(self):
>         super().__init__()
>     def forward_feature(self, x):
>         return x
> File = 'file.pth.tar'
> model = create_model(model_name,pretrained=False)
> model.load_state_dict(torch.load(File),strict=False)
> model.head = Identity()
> model.eval()

but i got
in forward
    out = self.head(x)
  File "/home/user/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 175, in _forward_unimplemented
    raise NotImplementedError
NotImplementedError

I don’t know why it calls the forward method and I used the forward_feature method