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

Function IsSingleNone

tensorflow/python/lib/core/py_func.cc:113–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113bool IsSingleNone(PyObject* obj) {
114 if (!PyArray_Check(obj)) {
115 return false;
116 }
117 PyArrayObject* array_obj = reinterpret_cast<PyArrayObject*>(obj);
118 if (PyArray_NDIM(array_obj) != 0 || PyArray_SIZE(array_obj) != 1) {
119 return false;
120 }
121 std::array<npy_intp, 0> indices;
122 char* item_ptr =
123 static_cast<char*>(PyArray_GetPtr(array_obj, indices.data()));
124 PyObject* item = PyArray_GETITEM(array_obj, item_ptr);
125 CHECK(item);
126 return item == Py_None;
127}
128
129// Retrieves a Tensor from `eager_tensor` and stores it in `output_tensor`.
130// Validates that `output_tensor` is backed by memory in `expected_device`

Callers 1

DoCallPyFuncFunction · 0.85

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected