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

Function CastPyArg2Long

paddle/fluid/pybind/op_function_common.cc:350–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350int64_t CastPyArg2Long(PyObject* obj,
351 const std::string& op_type,
352 ssize_t arg_pos) {
353 if (PyObject_CheckLong(obj)) {
354 return PyObject_ToInt64(obj);
355 } else {
356 PADDLE_THROW(common::errors::InvalidType(
357 "%s(): argument (position %d) must be "
358 "long, but got %s",
359 op_type,
360 arg_pos + 1,
361 ((PyTypeObject*)obj->ob_type)->tp_name)); // NOLINT
362 }
363
364 return 0;
365}
366int64_t CastPyArg2Long(PyObject* obj,
367 const std::string& op_type,
368 ssize_t arg_pos,

Callers 8

parse_attrFunction · 0.85
CastNumpy2ScalarFunction · 0.85
CastPyArg2ScalarFunction · 0.85
eager_api_run_custom_opFunction · 0.85
CastPyArg2AttrLongFunction · 0.85
ArgMaxMinMapperFunction · 0.85
KthvalueMapperFunction · 0.85

Calls 2

PyObject_CheckLongFunction · 0.85
PyObject_ToInt64Function · 0.85

Tested by

no test coverage detected