aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/framework/lookup_interface.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-10-09 16:23:35 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-09 16:39:23 -0700
commit6c391166b8b6ba43d2b0151e6fb9cf14864131a2 (patch)
treec8c3c9eadade00f1a4e6cec2024e2a15bfd0b948 /tensorflow/core/framework/lookup_interface.h
parent2f5ebc0ea5e6d500ea8cd925234c569d6b32fd4e (diff)
Add 'remove' operation to MutableHashTable and MutableDenseHashTable.
PiperOrigin-RevId: 216443201
Diffstat (limited to 'tensorflow/core/framework/lookup_interface.h')
-rw-r--r--tensorflow/core/framework/lookup_interface.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/tensorflow/core/framework/lookup_interface.h b/tensorflow/core/framework/lookup_interface.h
index 0622dd06cb..d33945fd1b 100644
--- a/tensorflow/core/framework/lookup_interface.h
+++ b/tensorflow/core/framework/lookup_interface.h
@@ -64,6 +64,17 @@ class LookupInterface : public ResourceBase {
virtual Status Insert(OpKernelContext* ctx, const Tensor& keys,
const Tensor& values) = 0;
+ // Removes elements from the table.
+ // This method is only implemented in mutable tables that can be updated over
+ // the execution of the graph. It returns Status::NotImplemented for read-only
+ // tables that are initialized once before they can be looked up.
+
+ // Returns the following statuses:
+ // - OK: when the remove finishes successfully.
+ // - InvalidArgument: if any of the preconditions on the lookup key fails.
+ // - Unimplemented: if the table does not support removals.
+ virtual Status Remove(OpKernelContext* ctx, const Tensor& keys) = 0;
+
// Returns the number of elements in the table.
virtual size_t size() const = 0;
@@ -107,6 +118,12 @@ class LookupInterface : public ResourceBase {
virtual Status CheckKeyAndValueTensorsForImport(const Tensor& keys,
const Tensor& values);
+ // Check format of the key tensor for the Remove function.
+ // Returns OK if all the following requirements are satisfied, otherwise it
+ // returns InvalidArgument:
+ // - DataType of the tensor keys equals to the table key_dtype
+ virtual Status CheckKeyTensorForRemove(const Tensor& keys);
+
// Check the arguments of a find operation. Returns OK if all the following
// requirements are satisfied, otherwise it returns InvalidArgument:
// - DataType of the tensor keys equals to the table key_dtype