I want the foward( ) have two modes depend on the self.last_only
Now the issue is self.last_only is NOT updated according to my will.
class Model(nn.Module):
def __init__(self)
self.last_only = None
def forward(self, x1, x2):
print('self.last_only = ', self.last_only)
def last_only(model, log=print):
model.last_only = True
print('model.last_only = ', model.last_only)
model(x1, x2)
It prints out None.