diff --git a/paddle/fluid/pybind/eager.cc b/paddle/fluid/pybind/eager.cc index be7c60334a68a0e4d5e577552bd280549fdac675..9484d506b20fb69c0f2758c3597f6496076c7e30 100644 --- a/paddle/fluid/pybind/eager.cc +++ b/paddle/fluid/pybind/eager.cc @@ -741,6 +741,10 @@ extern struct PyGetSetDef variable_properties[]; extern PyMethodDef variable_methods[]; +PyNumberMethods number_methods; +PySequenceMethods sequence_methods; +PyMappingMethods mapping_methods; + PyTypeObject eager_tensor_type = { PyVarObject_HEAD_INIT(NULL, 0) "core_avx.eager.EagerTensor", /* tp_name */ sizeof(EagerTensorObject), /* tp_basicsize */ @@ -751,9 +755,9 @@ PyTypeObject eager_tensor_type = { 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ + &number_methods, /* tp_as_number */ + &sequence_methods, /* tp_as_sequence */ + &mapping_methods, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */