I am trying to rewrite inference part so as to also return hidden layer activations like embeddings.
is this correct implementation, any potential issues with this ?
class FeatureExtration(torch.nn.Module):
def __init__(self, pretrained_model):
super().__init__()
self.__dict__ = pretrained_model.__dict__.copy()
def forward(self,x):
#... copy original forward ...
return proba, embedings, some_other_layer
model2 = FeatureExtration(pretrained_model)