| 932 | } |
| 933 | |
| 934 | tensorflow::int64 PyEagerTensor_NumElements(const PyObject* tensor) { |
| 935 | DCHECK(EagerTensor_CheckExact(tensor)); |
| 936 | const EagerTensor* as_c_eager_tensor = |
| 937 | reinterpret_cast<const EagerTensor*>(tensor); |
| 938 | tensorflow::int64 result = TFE_TensorHandleNumElements( |
| 939 | as_c_eager_tensor->handle, as_c_eager_tensor->status); |
| 940 | |
| 941 | if (MaybeRaiseExceptionFromTFStatus(as_c_eager_tensor->status, |
| 942 | PyExc_ValueError)) { |
| 943 | // Cleanup status before returning. |
| 944 | TF_SetStatus(as_c_eager_tensor->status, TF_OK, ""); |
| 945 | return -1; |
| 946 | } |
| 947 | |
| 948 | return result; |
| 949 | } |
| 950 | |
| 951 | PyObject* TFE_Py_InitEagerTensor(PyObject* base_class) { |
| 952 | if (!PyType_Check(base_class)) { |
no test coverage detected