Well I don’t really know the intrinsecs of TF.
Anyway in both cases (TF and PT), the gradients should depend on both outputs.
I don’t really know if TF is not duplicating the graph (to do so it should detect you are carrying out the same common_op with the same input)
Since there is no change in the tensor there is nothing to use as flag . Yet suggesting to externalize the common_op