| 1186 | bool HasAccumulator(); |
| 1187 | |
| 1188 | PyObject* TFE_Py_RegisterVSpace(PyObject* e) { |
| 1189 | if (py_vspace != nullptr) { |
| 1190 | if (HasAccumulator()) { |
| 1191 | // Accumulators reference py_vspace, so we can't swap it out while one is |
| 1192 | // active. This is unlikely to ever happen. |
| 1193 | MaybeRaiseExceptionFromStatus( |
| 1194 | tensorflow::errors::Internal( |
| 1195 | "Can't change the vspace implementation while a " |
| 1196 | "forward accumulator is active."), |
| 1197 | nullptr); |
| 1198 | } |
| 1199 | delete py_vspace; |
| 1200 | } |
| 1201 | |
| 1202 | py_vspace = new PyVSpace(e); |
| 1203 | auto status = py_vspace->Initialize(); |
| 1204 | if (MaybeRaiseExceptionFromStatus(status, nullptr)) { |
| 1205 | delete py_vspace; |
| 1206 | return nullptr; |
| 1207 | } |
| 1208 | |
| 1209 | Py_RETURN_NONE; |
| 1210 | } |
| 1211 | |
| 1212 | PyObject* PyTapeTensor::GetShape() const { |
| 1213 | if (shape_.index() == 0) { |
nothing calls this directly
no test coverage detected