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
This commit is contained in:
Edward Yang
2019-12-02 12:18:20 -08:00
committed by Facebook Github Bot
parent 6deb41c88d
commit 1111a6b810
42 changed files with 195 additions and 164 deletions

View File

@ -10,7 +10,7 @@
#include <torch/csrc/autograd/python_variable.h>
#include <torch/csrc/autograd/python_hook.h>
#include <torch/csrc/autograd/python_anomaly_mode.h>
#include <torch/csrc/utils/auto_gil.h>
#include <pybind11/pybind11.h>
#include <torch/csrc/utils/python_strings.h>
#include <torch/csrc/DynamicTypes.h>
#include <torch/csrc/Exceptions.h>
@ -48,7 +48,7 @@ PyObject* THPCppFunction_call(PyObject* self, PyObject* args, PyObject *kwargs)
variable_list output;
HANDLE_TH_ERRORS {
AutoNoGIL nogil;
pybind11::gil_scoped_release nogil;
output = (*((THPCppFunction*)self)->cdata)(std::move(vars));
}
END_HANDLE_TH_ERRORS