Call `PyArray_Check` only if NumPy is available (#66433)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/66353
Fixes #{issue number}
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66433
Reviewed By: seemethere, janeyx99
Differential Revision: D31548290
Pulled By: malfet
fbshipit-source-id: 3b094bc8195d0392338e0bdc6df2f39587b85bb3