diff --git a/paddle/utils/pybind.cc b/paddle/utils/pybind.cc index 24b1c4f65c3e2b8b236aba3f5348edd62810f4bf..7e93dcff1400ae9e57960e66be0fdb078d782155 100644 --- a/paddle/utils/pybind.cc +++ b/paddle/utils/pybind.cc @@ -21,8 +21,8 @@ DECLARE_string(tensor_operants_mode); namespace paddle { namespace pybind { -PyTypeObject* p_tensor_type; -PyTypeObject* p_string_tensor_type; +PyTypeObject* p_tensor_type = nullptr; +PyTypeObject* p_string_tensor_type = nullptr; bool PyCheckTensor(PyObject* obj) { if (!p_tensor_type) { diff --git a/paddle/utils/pybind.h b/paddle/utils/pybind.h index 4c4ef296a4ed6204f45e6796644c5ddcd75d09fc..c065a8de223cc9ff7a682c18d503c84c4d439729 100644 --- a/paddle/utils/pybind.h +++ b/paddle/utils/pybind.h @@ -24,8 +24,6 @@ namespace py = pybind11; namespace paddle { namespace pybind { -extern PyTypeObject* p_tensor_type; - typedef struct { PyObject_HEAD paddle::Tensor tensor; // Weak references