diff --git a/tensorflow/python/debug/BUILD b/tensorflow/python/debug/BUILD index f2d55118d3a..a6178fce24b 100644 --- a/tensorflow/python/debug/BUILD +++ b/tensorflow/python/debug/BUILD @@ -1485,6 +1485,5 @@ sh_test( ], tags = [ "no_windows", - "noasan", # TODO(b/153204233) Re-enable after fixing memory leak. ], ) diff --git a/tensorflow/python/lib/core/py_seq_tensor.cc b/tensorflow/python/lib/core/py_seq_tensor.cc index f01c33fea36..6403ca3a0ea 100644 --- a/tensorflow/python/lib/core/py_seq_tensor.cc +++ b/tensorflow/python/lib/core/py_seq_tensor.cc @@ -680,8 +680,8 @@ typedef Converter BoolConverter; // The two may share underlying storage so changes to one may reflect in the // other. TFE_TensorHandle* NumpyToTFE_TensorHandle(TFE_Context* ctx, PyObject* obj) { - tensorflow::Tensor t; - tensorflow::Status status = tensorflow::NdarrayToTensor(obj, &t); + tensorflow::Tensor tensor; + tensorflow::Status status = tensorflow::NdarrayToTensor(obj, &tensor); if (!status.ok()) { PyErr_SetString(PyExc_ValueError, tensorflow::strings::StrCat( @@ -691,8 +691,8 @@ TFE_TensorHandle* NumpyToTFE_TensorHandle(TFE_Context* ctx, PyObject* obj) { return nullptr; } - return new TFE_TensorHandle{ - ctx->context->CreateLocalHandle(new TensorInterface(std::move(t)))}; + TensorInterface t(std::move(tensor)); + return new TFE_TensorHandle{ctx->context->CreateLocalHandle(&t)}; } } // namespace @@ -874,10 +874,10 @@ TFE_TensorHandle* PySeqToTFE_TensorHandle(TFE_Context* ctx, PyObject* obj, case DT_INVALID: // Only occurs for empty tensors. { - Tensor t(requested_dtype == DT_INVALID ? DT_FLOAT : requested_dtype, - TensorShape(state.inferred_shape)); - return new TFE_TensorHandle{ - ctx->context->CreateLocalHandle(new TensorInterface(std::move(t)))}; + Tensor tensor(requested_dtype == DT_INVALID ? DT_FLOAT : requested_dtype, + TensorShape(state.inferred_shape)); + TensorInterface t(std::move(tensor)); + return new TFE_TensorHandle{ctx->context->CreateLocalHandle(&t)}; } default: