Thanks, Kushajveer. This was not working either, I got an operand type not matching error. Besides, that would not broadcast properly if I were to do that right?
I’ve ended up refactoring this function by using .clone() when needed to keep new tensor in the graph.