Revert "remove torch.equal usages (#89527)"
This reverts commit 4095ef8b809f922f2e0e09011afd00037d20a771.
Reverted https://github.com/pytorch/pytorch/pull/89527 on behalf of https://github.com/clee2000 due to broke periodic multigpu tests https://hud.pytorch.org/pytorch/pytorch/commit/4095ef8b809f922f2e0e09011afd00037d20a771 https://github.com/pytorch/pytorch/actions/runs/3592806602/jobs/6049368502