| 251 | } |
| 252 | |
| 253 | TFE_TensorHandle* PySeqToTFE_TensorHandle(PyObject* value, DataType dtype) { |
| 254 | tensorflow::TensorHandle* handle = nullptr; |
| 255 | tensorflow::Tensor t; |
| 256 | // TODO(josh11b): Have PySeqToTensor set python errors instead of |
| 257 | // returning Status. |
| 258 | auto cppstatus = tensorflow::PySeqToTensor(value, dtype, &t); |
| 259 | if (cppstatus.ok()) { |
| 260 | cppstatus = tensorflow::TensorHandle::CreateLocalHandle(t, &handle); |
| 261 | } |
| 262 | if (!cppstatus.ok()) { |
| 263 | PyErr_SetString(PyExc_ValueError, cppstatus.error_message().c_str()); |
| 264 | return nullptr; |
| 265 | } |
| 266 | CHECK_NE(handle, nullptr); |
| 267 | return new TFE_TensorHandle(handle); |
| 268 | } |
| 269 | |
| 270 | TFE_TensorHandle* ConvertToEagerTensorUncached(TFE_Context* ctx, |
| 271 | PyObject* value, |
no test coverage detected