# Gradient Flow after detached

**URL:** <https://discuss.pytorch.org/t/gradient-flow-after-detached/200182>\
**Category:** Uncategorized\
**Created:** [April 3, 2024, 2:29pm UTC](https://discuss.pytorch.org/t/gradient-flow-after-detached/200182 "2024-04-03T14:29:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KSonPham](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ksonpham/32/60930_2.png) [@KSonPham](https://discuss.pytorch.org/u/KSonPham)\
**Post date:** [April 3, 2024, 2:29pm UTC](https://discuss.pytorch.org/t/gradient-flow-after-detached/200182/1 "2024-04-03T14:29:13Z")

</div>

Hi everyone,  
I’ve noticed an interesting behavior in my model. It utilizes the mmcv framework for both training and testing. The model features a backbone for creating BEV (Bird’s Eye View) features and two heads, pts\_bbox\_head and area\_head, for predictions. These heads share the BEV features from the backbone. However, when I detach and clone the BEV features for forwarding via area\_head, I observe that the features still get updated differently compared to completely removing the area\_head. Could you explain why that’s the case? Thanks

 ![image](https://discuss.pytorch.org/uploads/default/original/3X/7/3/73c6361ac7205ee154ed3c0b2d0632511c8d5d94.png)

- With area\_head:  

- Without area\_head:

---

<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:** [April 3, 2024, 7:55pm UTC](https://discuss.pytorch.org/t/gradient-flow-after-detached/200182/2 "2024-04-03T19:55:39Z")

</div>

Could you post a minimal and executable code snippet reproducing the issue?
