Use pybind11::gil_scoped_* functions instead of AutoGIL/AutoNoGIL (#30274)
Summary:
Reland of https://github.com/pytorch/pytorch/pull/29095
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30274
Differential Revision: D18762293
Pulled By: ezyang
fbshipit-source-id: d3d50c2dd12bcb678ab25fa708eb6587cc4b66f9