MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / RaiseIfNotPySequence

Function RaiseIfNotPySequence

tensorflow/python/eager/pywrap_tfe_src.cc:2806–2826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2804}
2805
2806bool RaiseIfNotPySequence(PyObject* seq, const string& attr_name) {
2807 if (!PySequence_Check(seq)) {
2808 PyErr_SetString(PyExc_TypeError,
2809 Printf("expected a sequence for attr %s, got %s instead",
2810 attr_name.data(), seq->ob_type->tp_name)
2811 .data());
2812
2813 return false;
2814 }
2815 if (PyArray_Check(seq) &&
2816 PyArray_NDIM(reinterpret_cast<PyArrayObject*>(seq)) != 1) {
2817 PyErr_SetString(PyExc_ValueError,
2818 Printf("expected a sequence for attr %s, got an ndarray "
2819 "with rank %d instead",
2820 attr_name.data(),
2821 PyArray_NDIM(reinterpret_cast<PyArrayObject*>(seq)))
2822 .data());
2823 return false;
2824 }
2825 return true;
2826}
2827
2828bool RunCallbacks(
2829 const FastPathOpExecInfo& op_exec_info, PyObject* args,

Callers 1

TFE_Py_FastPathExecute_CFunction · 0.85

Calls 2

PrintfFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected