[quant][graphmode][refactor] isScalar check (#39892)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/39892
Test Plan: Imported from OSS
Differential Revision: D22009856
fbshipit-source-id: fbc407499bcff0f25e44eedba3d6cd1225325c24