From 39284c4ebb542a33266c4b1a71f893ebc9bcc533 Mon Sep 17 00:00:00 2001 From: Katherine Tian Date: Thu, 13 Aug 2020 18:57:03 +0000 Subject: [PATCH] rename ListKeys to StackKeys --- tensorflow/core/kernels/map_kernels.cc | 3 +++ tensorflow/core/kernels/map_kernels.h | 9 +++------ tensorflow/core/ops/map_ops.cc | 4 +--- tensorflow/python/kernel_tests/map_ops_test.py | 6 +++--- tensorflow/python/ops/map_ops.py | 4 ++-- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tensorflow/core/kernels/map_kernels.cc b/tensorflow/core/kernels/map_kernels.cc index 53299cc24e0..4430fdf9217 100644 --- a/tensorflow/core/kernels/map_kernels.cc +++ b/tensorflow/core/kernels/map_kernels.cc @@ -41,6 +41,9 @@ REGISTER_KERNEL_BUILDER(Name("TensorMapErase").Device(DEVICE_CPU), REGISTER_KERNEL_BUILDER(Name("TensorMapHasKey").Device(DEVICE_CPU), TensorMapHasKey); +REGISTER_KERNEL_BUILDER(Name("TensorMapStackKeys").Device(DEVICE_CPU), + TensorMapStackKeys); + #undef REGISTER_TENSOR_MAP_OPS_CPU #define REGISTER_TENSOR_MAP_OPS_CPU(T) diff --git a/tensorflow/core/kernels/map_kernels.h b/tensorflow/core/kernels/map_kernels.h index 5b919879dbb..38f5d97bcd5 100644 --- a/tensorflow/core/kernels/map_kernels.h +++ b/tensorflow/core/kernels/map_kernels.h @@ -174,13 +174,12 @@ class TensorMapHasKey : public OpKernel { } }; -<<<<<<< HEAD -class TensorMapListKeys : public OpKernel { +class TensorMapStackKeys : public OpKernel { public: - explicit TensorMapListKeys(OpKernelConstruction* c) : OpKernel(c) { + explicit TensorMapStackKeys(OpKernelConstruction* c) : OpKernel(c) { OP_REQUIRES_OK(c, c->GetAttr("key_dtype", &key_dtype_)); } - ~TensorMapListKeys() override {} + ~TensorMapStackKeys() override {} void Compute(OpKernelContext* c) override { const TensorMap* m = nullptr; @@ -203,8 +202,6 @@ class TensorMapListKeys : public OpKernel { DataType key_dtype_; }; -======= ->>>>>>> erase_change template Status TensorMapBinaryAdd(OpKernelContext* c, const TensorMap& a, const TensorMap& b, TensorMap* out) { diff --git a/tensorflow/core/ops/map_ops.cc b/tensorflow/core/ops/map_ops.cc index 024c9838441..db84f646dff 100644 --- a/tensorflow/core/ops/map_ops.cc +++ b/tensorflow/core/ops/map_ops.cc @@ -74,14 +74,12 @@ REGISTER_OP("TensorMapHasKey") .Attr("key_dtype: type") .SetShapeFn(shape_inference::ScalarShape); -REGISTER_OP("TensorMapListKeys") +REGISTER_OP("TensorMapStackKeys") .Input("input_handle: variant") .Output("keys: key_dtype") .Attr("key_dtype: type") .SetShapeFn([](shape_inference::InferenceContext* c) { c->set_output(0, c->UnknownShape()); // output keys - //c->set_output(0, c->MakeShape({c->UnknownDim()})); - //c->set_output(0, c->Vector(2)); return Status::OK(); }); diff --git a/tensorflow/python/kernel_tests/map_ops_test.py b/tensorflow/python/kernel_tests/map_ops_test.py index 786ec281e6c..6caf20ef36b 100644 --- a/tensorflow/python/kernel_tests/map_ops_test.py +++ b/tensorflow/python/kernel_tests/map_ops_test.py @@ -132,7 +132,7 @@ class MapOpsTest(test_util.TensorFlowTestCase, parameterized.TestCase): self.assertAllClose(l, v) self.assertAllClose(l2, default_value) - def testListKeys(self): + def testStackKeys(self): m = map_ops.empty_tensor_map() k = constant_op.constant(1.0) k2 = constant_op.constant(2.0) @@ -142,13 +142,13 @@ class MapOpsTest(test_util.TensorFlowTestCase, parameterized.TestCase): v3 = constant_op.constant(23.0) m = map_ops.tensor_map_insert(m, k, v) m = map_ops.tensor_map_insert(m, k2, v2) - keys = map_ops.tensor_map_list_keys(m, k.dtype) + keys = map_ops.tensor_map_stack_keys(m, k.dtype) expected = constant_op.constant([1.0, 2.0]) self.assertAllClose(array_ops.shape(keys), array_ops.shape(expected)) self.assertAllClose(sort_ops.sort(keys), expected) m = map_ops.tensor_map_insert(m, k3, v3) - keys = map_ops.tensor_map_list_keys(m, k.dtype) + keys = map_ops.tensor_map_stack_keys(m, k.dtype) expected = constant_op.constant([1.0, 2.0, 3.0]) self.assertAllClose(array_ops.shape(keys), array_ops.shape(expected)) self.assertAllClose(sort_ops.sort(keys), expected) diff --git a/tensorflow/python/ops/map_ops.py b/tensorflow/python/ops/map_ops.py index 7b2b4ff5f37..5a18e1d5564 100644 --- a/tensorflow/python/ops/map_ops.py +++ b/tensorflow/python/ops/map_ops.py @@ -46,8 +46,8 @@ def tensor_map_erase(input_handle, key, value_dtype): def tensor_map_has_key(input_handle, key): return gen_map_ops.tensor_map_has_key(input_handle, key) -def tensor_map_list_keys(input_handle, key_dtype): - return gen_map_ops.tensor_map_list_keys(input_handle, key_dtype) +def tensor_map_stack_keys(input_handle, key_dtype): + return gen_map_ops.tensor_map_stack_keys(input_handle, key_dtype) @ops.RegisterGradient("TensorMapLookup") def LookupGrad(op, dval):