diff --git a/tensorflow/core/kernels/map_kernels.h b/tensorflow/core/kernels/map_kernels.h index 9e436bc5fcd..6b38fe7aee6 100644 --- a/tensorflow/core/kernels/map_kernels.h +++ b/tensorflow/core/kernels/map_kernels.h @@ -178,7 +178,8 @@ class TensorMapHasKey : public OpKernel { template Status TensorMapBinaryAdd(OpKernelContext* c, const TensorMap& a, - const TensorMap& b, TensorMap* out) { + const TensorMap& b, TensorMap* out) { + // binary add returns a union of keys, values with keys in the intersection are added out->tensors() = a.tensors(); for (const std::pair& p : b.tensors()) { absl::flat_hash_map::iterator it = out->tensors().find(p.first); @@ -196,11 +197,7 @@ Status TensorMapBinaryAdd(OpKernelContext* c, const TensorMap& a, template Status TensorMapZerosLike(OpKernelContext* c, const TensorMap& x, TensorMap* y) { - for (const std::pair& p : x.tensors()) { - Tensor val; - TF_RETURN_IF_ERROR(ZerosLikeTensor(c, p.second, &val)); - y->tensors().emplace(p.first, val); - } + // zeros like returns an empty map return Status::OK(); }