# Memory usage increases by at least 30 when applying model

**URL:** <https://discuss.pytorch.org/t/memory-usage-increases-by-at-least-30-when-applying-model/50587>\
**Category:** Uncategorized\
**Created:** [July 14, 2019, 6:47pm UTC](https://discuss.pytorch.org/t/memory-usage-increases-by-at-least-30-when-applying-model/50587 "2019-07-14T18:47:13Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [July 14, 2019, 11:23pm UTC](https://discuss.pytorch.org/t/memory-usage-increases-by-at-least-30-when-applying-model/50587/4 "2019-07-14T23:23:36Z")

</div>

Good to hear a batch size of 16 works.  
Yeah, the intermediate activations can be quite huge, e.g. especially if you are using a lot of kernels in a conv layer.

`.buffers` is used for internal tensors, which do not require gradients, e.g. the `running_mean` and `running_var` in batchnorm layers.  
If you want to get the intermediate outputs, you could register forward hooks as explained in [this post](https://discuss.pytorch.org/t/how-can-l-load-my-best-model-as-a-feature-extractor-evaluator/17254/6).

---

_[View the full topic](https://discuss.pytorch.org/t/memory-usage-increases-by-at-least-30-when-applying-model/50587)._
