delete backward_function;
});
+ Py_DECREF(num_inputs);
+
Py_RETURN_NONE;
}
Py_INCREF(output->get()); // stay alive after since tuple steals.
PyTuple_SET_ITEM(outputs.get(), 0, output->get());
- if (!RecordGradient(GetPythonObjectFromString("ReadVariableOp"),
- inputs.get(), Py_None, outputs.get(), Py_None)) {
+ tensorflow::Safe_PyObjectPtr op_string(
+ GetPythonObjectFromString("ReadVariableOp"));
+ if (!RecordGradient(op_string.get(), inputs.get(), Py_None, outputs.get(),
+ Py_None)) {
return false;
}
}