diff options
Diffstat (limited to 'tensorflow/core/framework/op_kernel.cc')
-rw-r--r-- | tensorflow/core/framework/op_kernel.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tensorflow/core/framework/op_kernel.cc b/tensorflow/core/framework/op_kernel.cc index c694e10193..80f2b12987 100644 --- a/tensorflow/core/framework/op_kernel.cc +++ b/tensorflow/core/framework/op_kernel.cc @@ -41,6 +41,7 @@ limitations under the License. #include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/mutex.h" #include "tensorflow/core/platform/types.h" +#include "tensorflow/core/util/ptr_util.h" namespace tensorflow { @@ -80,10 +81,8 @@ Status MatchSignatureHelper(const DataTypeSlice expected_inputs, // OpKernel ------------------------------------------------------------------ -// TODO(mrry): Convert to std::make_unique when available. OpKernel::OpKernel(OpKernelConstruction* context) - : OpKernel(context, - std::unique_ptr<const NodeDef>(new NodeDef(context->def()))) {} + : OpKernel(context, MakeUnique<const NodeDef>(context->def())) {} OpKernel::OpKernel(OpKernelConstruction* context, std::unique_ptr<const NodeDef> node_def) @@ -525,10 +524,8 @@ std::unique_ptr<Tensor> OpKernelContext::forward_input( return nullptr; } } - // TODO(rmlarsen): Use MakeUnique here. There is already a copy in - // tensorflow/compiler/xla/ptr_util.h. Perhaps this should be part of - // general cleanup of ownership in this code. - std::unique_ptr<Tensor> output_tensor(new Tensor()); + + auto output_tensor = MakeUnique<Tensor>(); CHECK(output_tensor->CopyFrom(*input.tensor, output_shape)); return output_tensor; } |