MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / PyObject_CheckLong

Function PyObject_CheckLong

paddle/fluid/pybind/op_function_common.cc:84–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84bool PyObject_CheckLong(PyObject* obj) {
85 if ((PyLong_Check(obj) && !PyBool_Check(obj)) || // NOLINT
86 PyObject_CheckVarType(obj) || // NOLINT
87 PyObject_CheckDataType(obj) || // NOLINT
88 (PyObject_CheckTensor(obj) &&
89 reinterpret_cast<TensorObject*>(obj)->tensor.numel() == 1)) {
90 return true;
91 }
92 std::string type_name =
93 std::string(reinterpret_cast<PyTypeObject*>(obj->ob_type)->tp_name);
94 if (type_name.find("numpy.int") != std::string::npos) {
95 return true;
96 }
97 return false;
98}
99
100int32_t PyObject_ToInt32(PyObject* obj) {
101 int64_t res = 0;

Callers 15

CastPyArg2AttrIntFunction · 0.85
CastPyArg2AttrLongFunction · 0.85
CastPyArg2AttrSize_tFunction · 0.85
CastPyArg2VectorOfIntFunction · 0.85
CastPyArg2VectorOfInt64Function · 0.85
CastPyArg2VectorOfSize_tFunction · 0.85
CastPyArg2ScalarFunction · 0.85
CastPyArg2ScalarArrayFunction · 0.85
CastPyArg2IntArrayFunction · 0.85
CastPyArg2IntFunction · 0.85

Calls 5

PyObject_CheckVarTypeFunction · 0.85
PyObject_CheckDataTypeFunction · 0.85
PyObject_CheckTensorFunction · 0.85
numelMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected