Skip to content

Commit 81e32b4

Browse files
committed
limitation clarification in README
1 parent 590dcb2 commit 81e32b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
This tool estimates the size of a [PyTorch](https://pytorch.org) model in memory for a given input size.
44
Estimating the size of a model in memory is useful when trying to determine an appropriate batch size, or when making architectural decisions.
55

6-
**Note:** The size estimates provided by this tool are theoretical estimates only, and the total memory used will vary depending on implementation details. PyTorch utilizes a few hundred MB of memory for CUDA initialization, and the use of cuDNN alters memory usage in a manner that is difficult to predict. See [this discussion on the PyTorch Forums](https://discuss.pytorch.org/t/gpu-memory-estimation-given-a-network/1713) for more detail.
6+
**Note (1):** `SizeEstimator` is only valid for models where dimensionality changes are exclusively carried out by modules in `model.modules()`.
7+
8+
For example, use of `nn.Functional.max_pool2d` in the `forward()` method of a model prevents `SizeEstimator` from functioning properly. There is no direct means to access dimensionality changes carried out by arbitrary functions in the `forward()` method, such that tracking the size of inputs and gradients to be stored is non-trivial for such models.
9+
10+
**Note (2):** The size estimates provided by this tool are theoretical estimates only, and the total memory used will vary depending on implementation details. PyTorch utilizes a few hundred MB of memory for CUDA initialization, and the use of cuDNN alters memory usage in a manner that is difficult to predict. See [this discussion on the PyTorch Forums](https://discuss.pytorch.org/t/gpu-memory-estimation-given-a-network/1713) for more detail.
711

812
[See this blog post](http://jacobkimmel.github.io/pytorch_estimating_model_size/) for an explanation of the size estimation logic.
913

0 commit comments

Comments
 (0)