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.
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.