- 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
This commit is contained in:
Xiao Yu 2020-09-23 19:07:41 -07:00 committed by TensorFlower Gardener
parent 9709a5af66
commit 01b975d175

View File

@ -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: