# Why is sourceTensor.clone() not a leaf variable?

**URL:** <https://discuss.pytorch.org/t/why-is-sourcetensor-clone-not-a-leaf-variable/47231>\
**Category:** Uncategorized\
**Created:** [June 6, 2019, 11:10am UTC](https://discuss.pytorch.org/t/why-is-sourcetensor-clone-not-a-leaf-variable/47231 "2019-06-06T11:10:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sbelharbi](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@sbelharbi](https://discuss.pytorch.org/u/sbelharbi)\
**Post date:** [June 6, 2019, 12:52pm UTC](https://discuss.pytorch.org/t/why-is-sourcetensor-clone-not-a-leaf-variable/47231/2 "2019-06-06T12:52:46Z")

</div>

To allow in-place operations for example.

[This](https://discuss.pytorch.org/t/how-to-perform-indexing-with-autograd/47225/2) for instance. Instead of adding `0.`, one can use `*.clone()` as in [here](https://discuss.pytorch.org/t/leaf-variable-was-used-in-an-inplace-operation/308/2).

---

_[View the full topic](https://discuss.pytorch.org/t/why-is-sourcetensor-clone-not-a-leaf-variable/47231)._
