mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Revert "Make Generator an Opaque Object (#179661)"
This reverts commit 18357d9483.
Reverted https://github.com/pytorch/pytorch/pull/179661 on behalf of https://github.com/yushangdi due to breaks pr_time_benchmarks ([comment](https://github.com/pytorch/pytorch/pull/179661#issuecomment-4285042651))
This commit is contained in:
@@ -241,7 +241,7 @@ static PyObject* THPModule_initExtension(
|
||||
|
||||
auto module = THPObjectPtr(PyImport_ImportModule("torch"));
|
||||
if (!module)
|
||||
throw python_error(); // @allow-raw-throw
|
||||
throw python_error();
|
||||
|
||||
THPStorage_postInit(module);
|
||||
THPAutograd_initFunctions();
|
||||
@@ -473,7 +473,7 @@ static PyObject* THPModule_addDocStr(PyObject* _unused, PyObject* args) {
|
||||
m->d_getset->name);
|
||||
}
|
||||
m->d_getset->doc = doc_str;
|
||||
} else if (PyType_Check(obj)) {
|
||||
} else if (Py_TYPE(obj) == &PyType_Type) {
|
||||
PyTypeObject* t = reinterpret_cast<PyTypeObject*>(obj);
|
||||
if (t->tp_doc) {
|
||||
return PyErr_Format(
|
||||
@@ -682,7 +682,7 @@ static PyObject* THPModule_torchDeviceToDLDevice(
|
||||
|
||||
auto tuple = PyTuple_New(2);
|
||||
if (!tuple) {
|
||||
throw python_error(); // @allow-raw-throw
|
||||
throw python_error();
|
||||
}
|
||||
|
||||
PyTuple_SET_ITEM(tuple, 0, THPUtils_packInt64(dl_device.device_type));
|
||||
|
||||
Reference in New Issue
Block a user