| 148 | |
| 149 | #if PY_MAJOR_VERSION < 3 |
| 150 | bool ParseInt64Value(const string& key, PyObject* py_value, TF_Status* status, |
| 151 | int64_t* value) { |
| 152 | if (PyInt_Check(py_value)) { |
| 153 | *value = static_cast<int64_t>(PyInt_AsLong(py_value)); |
| 154 | return true; |
| 155 | } else if (PyLong_Check(py_value)) { |
| 156 | *value = static_cast<int64_t>(PyLong_AsLong(py_value)); |
| 157 | return true; |
| 158 | } |
| 159 | TF_SetStatus( |
| 160 | status, TF_INVALID_ARGUMENT, |
| 161 | tensorflow::strings::StrCat("Expecting int or long value for attr ", key, |
| 162 | ", got ", py_value->ob_type->tp_name) |
| 163 | .c_str()); |
| 164 | return false; |
| 165 | } |
| 166 | #endif |
| 167 | |
| 168 | Py_ssize_t TensorShapeNumDims(PyObject* value) { |
no test coverage detected