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

Function ZeroDimArrayToScalar

tensorflow/python/lib/core/py_seq_tensor.cc:71–79  ·  view source on GitHub ↗

If the input is a zero dimensional PyArray return it converted to a scalar. Otherwise return the input and increment its reference count. Users must Py_DECREF the output of this method.

Source from the content-addressed store, hash-verified

69// Otherwise return the input and increment its reference count.
70// Users must Py_DECREF the output of this method.
71PyObject* ZeroDimArrayToScalar(PyObject* obj) {
72 if (PyArray_IsZeroDim(obj) && !PyArray_IsScalar(obj, Generic)) {
73 auto pyarray_obj = reinterpret_cast<PyArrayObject*>(obj);
74 obj = PyArray_ToScalar(PyArray_DATA(pyarray_obj), pyarray_obj);
75 } else {
76 Py_INCREF(obj);
77 }
78 return obj;
79}
80
81// Converts Python object `c` that should hold a Python string into a
82// C++ string in *out. Returns nullptr on success, or a message on error.

Callers 2

InferShapeAndTypeFunction · 0.85
py_seq_tensor.ccFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected