Hi why won’t the described behavior be seen in 3.
It seems as though this a python problem with the if statement because of the CPU.
I am unsure if this will help since I can’t reproduce the problem, but I will torch.equal work for 1? It outputs a bool pytorch/native_functions.yaml at 1be1c901aabd3ddcf55af3ee869e611b7f3f43b6 · pytorch/pytorch · GitHub. If it does for your if conditions you can write a GPU kernels.