[TS] Return early if device doesn't match (#66694)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66694
`lhs.equal(rhs)` would throw if the device doesn't match. To avoid that we return early if the device doesn't match.
Test Plan: CI
Reviewed By: houseroad
Differential Revision: D31691608
fbshipit-source-id: 513c3e0743a65d9778c7ef9b79ececfeaccc0017