# Clearing the GPU is a headache

**URL:** <https://discuss.pytorch.org/t/clearing-the-gpu-is-a-headache/84762>\
**Category:** vision\
**Created:** [June 9, 2020, 12:49pm UTC](https://discuss.pytorch.org/t/clearing-the-gpu-is-a-headache/84762 "2020-06-09T12:49:16Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Saifeddine\_Barkia](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/saifeddine_barkia/32/27005_2.png) [@Saifeddine\_Barkia](https://discuss.pytorch.org/u/Saifeddine_Barkia)\
**Post date:** [August 5, 2020, 8:00am UTC](https://discuss.pytorch.org/t/clearing-the-gpu-is-a-headache/84762/8 "2020-08-05T08:00:22Z")

</div>

@ptrblck sir, I have the same problem here, can you help me determine where I put the cuda. empty\_cache()?

> [@RuntimeError: CUDA out of memory?](https://discuss.pytorch.org/t/runtimeerror-cuda-out-of-memory/91385/4):
>
> Check the attention\_maps and raw\_features, as well. If they are not scalers, and they do not participate in the training (contribute to it, and you are just using them as pure outputs) considert doing a detach() on them as well.

---

_[View the full topic](https://discuss.pytorch.org/t/clearing-the-gpu-is-a-headache/84762)._
