# Need to resize my tensor on the current graph(backward)

**URL:** <https://discuss.pytorch.org/t/need-to-resize-my-tensor-on-the-current-graph-backward/127742>\
**Category:** Uncategorized\
**Created:** [July 26, 2021, 9:16am UTC](https://discuss.pytorch.org/t/need-to-resize-my-tensor-on-the-current-graph-backward/127742 "2021-07-26T09:16:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tianle-BigRice](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/t/5daacb/32.png) [@tianle-BigRice](https://discuss.pytorch.org/u/tianle-BigRice)\
**Post date:** [July 26, 2021, 9:16am UTC](https://discuss.pytorch.org/t/need-to-resize-my-tensor-on-the-current-graph-backward/127742/1 "2021-07-26T09:16:52Z")

</div>

The problem is that I need to resize my tensor on the current graph as shown below:

```auto
img = skimage.transform.resize(img, (C, H * scale, W * scale), mode='reflect',anti_aliasing=False)

```

How can I resize my tensor without detached the current graph. Or resize to the current graph after adjusting my tensor while detached the current graph.

---

<div class="post-metadata">

**Author:** ![JuanFMontesinos](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/juanfmontesinos/32/76115_2.png) [@JuanFMontesinos](https://discuss.pytorch.org/u/JuanFMontesinos)\
**Post date:** [July 26, 2021, 10:49pm UTC](https://discuss.pytorch.org/t/need-to-resize-my-tensor-on-the-current-graph-backward/127742/2 "2021-07-26T22:49:27Z")

</div>

You can use pytorch resize which should match that one.  
[https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html](https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html)

As a layer:  
[https://pytorch.org/docs/stable/generated/torch.nn.Upsample.html?highlight=resize](https://pytorch.org/docs/stable/generated/torch.nn.Upsample.html?highlight=resize)
