caffe2 test.sh pip might not need sudo if pip is root (#50223)
Summary:
Update logic in MAYBE_SUDO check. Assumption was incorrect that if pip
was installed as user then sudo is needed. pip could be installed as
root and run as root. Assumption was initially pip was root and user was
non root.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/50223
Reviewed By: H-Huang
Differential Revision: D26212127
Pulled By: walterddr
fbshipit-source-id: 20b316606b6c210dc705a972c13088fa3d9bfddd