At PyTorch model
that inherit from torch.nn.Module
can be set to train
or eval
modes using model.train()
or model.eval()
. Is there a way to do this globally for the present PyTorch session, so that it applies to any op that is invoked, without having to update different models?
This could be useful in running PyTorch scripts in training or inference context as desired.