Skip to content

Commit 1083490

Browse files
Code compactness
1 parent 1a9eb48 commit 1083490

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

torch/csrc/autograd/python_function.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,9 @@ static void _trace_post_record(
559559
}
560560

561561
node->i_(jit::attr::inplace, is_inplace);
562-
if (node) {
563-
auto module_name = PyDict_GetItemString(((PyTypeObject*)op_obj)->tp_dict, "__module__");
564-
if (module_name) {
565-
const char *ptr = PyUnicode_AsUTF8(module_name);
566-
if (ptr) {
567-
auto modname = std::string(ptr);
568-
node->s_(jit::attr::module, modname);
569-
}
562+
if (auto module_name = PyDict_GetItemString(((PyTypeObject*)op_obj)->tp_dict, "__module__")) {
563+
if (auto ptr = PyUnicode_AsUTF8(module_name)) {
564+
node->s_(jit::attr::module, std::string(ptr));
570565
}
571566
}
572567

0 commit comments

Comments
 (0)