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

Function CastPyArg2Int

paddle/fluid/pybind/op_function_common.cc:317–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317int CastPyArg2Int(PyObject* obj, const std::string& op_type, ssize_t arg_pos) {
318 if (PyObject_CheckLong(obj)) {
319 return PyObject_ToInt32(obj);
320 } else {
321 PADDLE_THROW(common::errors::InvalidType(
322 "%s(): argument (position %d) must be "
323 "int, but got %s",
324 op_type,
325 arg_pos + 1,
326 ((PyTypeObject*)obj->ob_type)->tp_name)); // NOLINT
327 }
328
329 return 0;
330}
331int CastPyArg2Int(PyObject* obj,
332 const std::string& op_type,
333 ssize_t arg_pos,

Callers 10

static_api_array_readFunction · 0.85
static_api_fetchFunction · 0.85
static_api_array_write_Function · 0.85
static_api_array_popFunction · 0.85
parse_attrFunction · 0.85
CastNumpy2ScalarFunction · 0.85
CastPyArg2ScalarFunction · 0.85
CastPyArg2AttrIntFunction · 0.85
KthvalueMapperFunction · 0.85

Calls 2

PyObject_CheckLongFunction · 0.85
PyObject_ToInt32Function · 0.85

Tested by

no test coverage detected