Revert D17464904: Add NoQEngine to QEngine and refactor the name of set/get qengine

Test Plan: revert-hammer

Differential Revision:
D17464904

Original commit changeset: d8f2cebb978f

fbshipit-source-id: 8feb86f7347f455eb51538ce7893d4a096ba0ba4
This commit is contained in:
Ailing Zhang
2019-09-18 19:58:54 -07:00
committed by Facebook Github Bot
parent cbc7172a02
commit b1ecf4bc82
8 changed files with 26 additions and 55 deletions

View File

@ -489,17 +489,17 @@ PyObject *THPModule_getDefaultDevice(PyObject *_unused, PyObject *arg) {
END_HANDLE_TH_ERRORS
}
PyObject *THPModule_setQEngine(PyObject *_unused, PyObject *arg)
PyObject *THPModule_setPreferredQuantizedEngine(PyObject *_unused, PyObject *arg)
{
TORCH_CHECK(THPQEngine_Check(arg), "qengine arg must be an instance of the torch.qengine");
const auto qengine = reinterpret_cast<THPQEngine*>(arg);
at::globalContext().setQEngine(qengine->qengine);
at::globalContext().setPreferredQuantizedEngine(qengine->qengine);
Py_RETURN_NONE;
}
PyObject *THPModule_qEngine(PyObject *_unused)
PyObject *THPModule_preferredQuantizedEngine(PyObject *_unused)
{
return THPQEngine_New(at::globalContext().qEngine(), toString(at::globalContext().qEngine()));
return THPQEngine_New(at::globalContext().preferredQuantizedEngine(), toString(at::globalContext().preferredQuantizedEngine()));
}
static PyMethodDef TorchMethods[] = {
@ -538,8 +538,8 @@ static PyMethodDef TorchMethods[] = {
{"set_flush_denormal", (PyCFunction)THPModule_setFlushDenormal, METH_O, nullptr},
{"get_default_dtype", (PyCFunction)THPModule_getDefaultDtype, METH_NOARGS, nullptr},
{"_get_default_device", (PyCFunction)THPModule_getDefaultDevice, METH_NOARGS, nullptr},
{"_get_qengine", (PyCFunction)THPModule_qEngine, METH_NOARGS, nullptr},
{"_set_qengine", (PyCFunction)THPModule_setQEngine, METH_O, nullptr},
{"_get_preferred_engine", (PyCFunction)THPModule_preferredQuantizedEngine, METH_NOARGS, nullptr},
{"_set_preferred_engine", (PyCFunction)THPModule_setPreferredQuantizedEngine, METH_O, nullptr},
{nullptr, nullptr, 0, nullptr}
};