# Issue with tensor: RuntimeError element 0 of tensors does not require grad and does not have a grad\_fn

**URL:** <https://discuss.pytorch.org/t/issue-with-tensor-runtimeerror-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn/91745>\
**Category:** Uncategorized\
**Created:** [August 5, 2020, 5:13pm UTC](https://discuss.pytorch.org/t/issue-with-tensor-runtimeerror-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn/91745 "2020-08-05T17:13:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Nikronic](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nikronic/32/71873_2.png) [@Nikronic](https://discuss.pytorch.org/u/Nikronic)\
**Post date:** [August 5, 2020, 7:11pm UTC](https://discuss.pytorch.org/t/issue-with-tensor-runtimeerror-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn/91745/2 "2020-08-05T19:11:19Z")

</div>

> [@Palash\_Shah](#):
>
> `outputs = combine_channel(outputs)`

The issue is that you are converting tensors to numpy and it breaks the computational graph. I have provided a solution in your first code as there is easier way to achieve `combine_channel`.

> [@Torch tensor reshape by removing a channel](https://discuss.pytorch.org/t/torch-tensor-reshape-by-removing-a-channel/91651/5):
>
> You can do this by torch.max output = torch.randn(1, 2, 64, 64, 64) output,\_ = torch.max(output, 1, keepdim=True) print(output.shape) # [1, 1, 64, 64, 64]

---

_[View the full topic](https://discuss.pytorch.org/t/issue-with-tensor-runtimeerror-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn/91745)._
