| 166 | #endif |
| 167 | |
| 168 | Py_ssize_t TensorShapeNumDims(PyObject* value) { |
| 169 | const auto size = PySequence_Size(value); |
| 170 | if (size == -1) { |
| 171 | // TensorShape.__len__ raises an error in the scenario where the shape is an |
| 172 | // unknown, which needs to be cleared. |
| 173 | // TODO(nareshmodi): ensure that this is actually a TensorShape. |
| 174 | PyErr_Clear(); |
| 175 | } |
| 176 | return size; |
| 177 | } |
| 178 | |
| 179 | bool IsInteger(PyObject* py_value) { |
| 180 | #if PY_MAJOR_VERSION >= 3 |
no outgoing calls
no test coverage detected