From 01b975d17553b92601ed1c3fe6bbeefc6d0146e3 Mon Sep 17 00:00:00 2001 From: Xiao Yu Date: Wed, 23 Sep 2020 19:07:41 -0700 Subject: [PATCH] - Allow creating complex and unsigned scalar tensor in TFRT. - Use AbstractContext to create Tensor to support creating Tensor when turning TFRT on. PiperOrigin-RevId: 333421621 Change-Id: I0f877fa347fc84521d9a3e7c6a2636af389cf597 --- tensorflow/python/lib/core/py_seq_tensor.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tensorflow/python/lib/core/py_seq_tensor.cc b/tensorflow/python/lib/core/py_seq_tensor.cc index 9acb6d4a283..f430142a73c 100644 --- a/tensorflow/python/lib/core/py_seq_tensor.cc +++ b/tensorflow/python/lib/core/py_seq_tensor.cc @@ -880,10 +880,13 @@ TFE_TensorHandle* PySeqToTFE_TensorHandle(TFE_Context* ctx, PyObject* obj, case DT_INVALID: // Only occurs for empty tensors. { - Tensor tensor(requested_dtype == DT_INVALID ? DT_FLOAT : requested_dtype, - TensorShape(state.inferred_shape)); - TensorInterface t(std::move(tensor)); - return tensorflow::wrap(tensorflow::unwrap(ctx)->CreateLocalHandle(&t)); + AbstractTensorInterface* t = tensorflow::unwrap(ctx)->CreateTensor( + requested_dtype == DT_INVALID ? DT_FLOAT : requested_dtype, + state.inferred_shape); + auto* result = + tensorflow::wrap(tensorflow::unwrap(ctx)->CreateLocalHandle(t)); + t->Release(); + return result; } default: