By default, PyTorch will store activations etc. for computing gradients. This will cause the CNN method to consume a large amount of GPU memory, ultimately causing GPU out-of-memory error when the dataset is large.
This pull request adds torch.no_grad context manager to disable gradient calculation and reduce memory consumption when computing CNN features.
By default, PyTorch will store activations etc. for computing gradients. This will cause the CNN method to consume a large amount of GPU memory, ultimately causing GPU out-of-memory error when the dataset is large.
This pull request adds
torch.no_grad
context manager to disable gradient calculation and reduce memory consumption when computing CNN features.