mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fix segmentation fault in grad_fn (#9292)
Summary: Fixes #8774 . Reviewed By: soumith Differential Revision: D8836478 Pulled By: apaszke fbshipit-source-id: f113bf47fe493be9f095a5a5490caf08dbb44e38
This commit is contained in:
committed by
Facebook Github Bot
parent
bcd20f96e0
commit
86eeeab758
@ -27,6 +27,11 @@ PyObject* THPCppFunction_call(PyObject* self, PyObject* args, PyObject *kwargs)
|
||||
}
|
||||
|
||||
int num_inputs = PyTuple_GET_SIZE(args);
|
||||
int num_inputs_required = ((THPCppFunction*)self)->cdata->num_inputs();
|
||||
if (num_inputs != num_inputs_required) {
|
||||
return PyErr_Format(PyExc_TypeError, "expected %d arguments, got %d instead",
|
||||
num_inputs_required, num_inputs);
|
||||
}
|
||||
variable_list vars(num_inputs);
|
||||
for (int i = 0; i != num_inputs; ++i) {
|
||||
PyObject* arg = PyTuple_GET_ITEM(args, i);
|
||||
|
||||
Reference in New Issue
Block a user