Just for teaching: torch.inference_mode is a bit faster, and it prompts the question of how is it different from torch.no_grad (afaik, it's because things created under no_grad can participate in downstream grad calcs as constants, but inference_mode is much stricter and will error completely if you tried the same thing!).
Really nice project :)
miniature/model.py
Line 25 in dfe1bd1
Just for teaching:
torch.inference_modeis a bit faster, and it prompts the question of how is it different fromtorch.no_grad(afaik, it's because things created underno_gradcan participate in downstream grad calcs as constants, butinference_modeis much stricter and will error completely if you tried the same thing!).Really nice project :)