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

Function CastPyArg2AttrBoolean

paddle/fluid/pybind/eager_utils.cc:279–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279bool CastPyArg2AttrBoolean(PyObject* obj, ssize_t arg_pos) {
280 if (obj == Py_None || obj == Py_False) {
281 return false; // To be compatible with QA integration testing. Some
282 // test cases pass in None.
283 } else if (obj == Py_True) {
284 return true;
285 } else {
286 PADDLE_THROW(common::errors::InvalidType(
287 "argument (position %d) must be "
288 "bool, but got %s",
289 arg_pos + 1,
290 (reinterpret_cast<PyTypeObject*>(obj->ob_type))->tp_name));
291 }
292}
293
294int CastPyArg2AttrInt(PyObject* obj, ssize_t arg_pos) {
295 if (PyObject_CheckLong(obj)) {

Callers 15

static_api_run_custom_opFunction · 0.70
eager_api_scaleFunction · 0.70
eager_api_run_backwardFunction · 0.70
eager_api_tensor_copyFunction · 0.70
eager_api_run_custom_opFunction · 0.70
eager_method.ccFile · 0.70
tensor_clear_gradientFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected