Skip to content

Commit

Permalink
Update on "Add Python declaration of torch._C and torch._C._autograd …
Browse files Browse the repository at this point in the history
…modules."

Differential Revision: [D24761503](https://our.internmc.facebook.com/intern/diff/D24761503)

[ghstack-poisoned]
  • Loading branch information
xuzhao9 committed Nov 6, 2020
1 parent f1c2415 commit e0bae07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions torch/csrc/distributed/autograd/init.cpp
Expand Up @@ -23,8 +23,10 @@ PyObject* dist_autograd_init(PyObject* _unused, PyObject* noargs) {
}

auto torch_C_module = THPObjectPtr(PyImport_ImportModule("torch._C"));
if (!torch_C_module)
return nullptr;
if (!torch_C_module) {
throw python_error();
}

auto torch_C_m = py::handle(torch_C_module).cast<py::module>();
auto m = torch_C_m.def_submodule("_distributed_autograd", "distributed autograd bindings");

Expand Down

0 comments on commit e0bae07

Please sign in to comment.