<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/11365001/56267119-79b0fa00-6120-11e9-9b1d-cbebf41fb67f.png"><img src="https://user-images.githubusercontent.com/11365001/56267119-79b0fa00-6120-11e9-9b1d-cbebf41fb67f.png" alt="image" style="max-width: 100%;"></a></p>
<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>

<h2 dir="auto">To Reproduce</h2>
<p dir="auto">here is my code</p>
<p dir="auto">auto out = faceDetect-&gt;forward({ tensor_image }).toTuple();<br>
c10::cuda::CUDACachingAllocator::emptyCache();<br>
...some tensor ops on gpu<br>
boundingBoxesOfOne = torch::masked_select(boundingBoxesOfOne, mask);</p>
<p dir="auto">faceDetect is a sfd net,after forward(),if i call emptyCache(),it will cost 170ms time to emptyCache;if i don't call emptyCache(),masked_select will cost 170ms;so i don't know how to optimize this situation，thks！</p>
<h2 dir="auto">Environment</h2>
<p dir="auto">libtorch Version 1.0 :<br>
OS windows10:<br>
CUDA/cuDNN version: 9.0<br>
GPU models and configuration: GTX 1060</p>
<h2 dir="auto">Additional context</h2>