Hello, I have this model class with two submodules, self.extractor and self.mlp.
class Model(nn.Module):
def __init__(self, ):
super(Model, self).__init__()
self.extractor = ....
self.extractor.eval()
self.mlp = .....
The extractor is used to extract feature vector from the image and the self.mlp is used to perform the classification. In my case, I’d like the extractor to be in eval() mode all the time, but only train the self.mlp. However, in my training loop, I set up the Model into train():
model = Model()
def train_one_batch():
model.train()
......
Now, I am confused if this line ‘model.train()’ will set the self.extractor to the train() mode and fails my goal.