1// This file is MACHINE GENERATED! Do not edit.
2
3#ifndef TENSORFLOW_CC_OPS_LOOKUP_OPS_INTERNAL_H_
4#define TENSORFLOW_CC_OPS_LOOKUP_OPS_INTERNAL_H_
5
6// This file is MACHINE GENERATED! Do not edit.
7
8#include "tensorflow/cc/framework/ops.h"
9#include "tensorflow/cc/framework/scope.h"
10#include "tensorflow/core/framework/tensor.h"
11#include "tensorflow/core/framework/tensor_shape.h"
12#include "tensorflow/core/framework/types.h"
13#include "tensorflow/core/lib/gtl/array_slice.h"
14
15namespace tensorflow {
16namespace ops {
17namespace internal {
18// NOTE: This namespace has internal TensorFlow details that
19// are not part of TensorFlow's public API.
20
21/// @defgroup lookup_ops_internal Lookup Ops Internal
22/// @{
23
24/// Creates a uninitialized anonymous hash table.
25///
26/// This op creates a new anonymous hash table (as a resource) everytime
27/// it is executed, with the specified dtype of its keys and values,
28/// returning the resource handle. Before using the table you will have
29/// to initialize it. After initialization the table will be
30/// immutable. The table is anonymous in the sense that it can only be
31/// accessed by the returned resource handle (e.g. it cannot be looked up
32/// by a name in a resource manager). The table will be automatically
33/// deleted when all resource handles pointing to it are gone.
34///
35/// Args:
36/// * scope: A Scope object
37/// * key_dtype: Type of the table keys.
38/// * value_dtype: Type of the table values.
39///
40/// Returns:
41/// * `Output`: The resource handle to the newly created hash-table resource.
42class AnonymousHashTable {
43 public:
44 AnonymousHashTable(const ::tensorflow::Scope& scope, DataType key_dtype,
45 DataType value_dtype);
46 operator ::tensorflow::Output() const { return table_handle; }
47 operator ::tensorflow::Input() const { return table_handle; }
48 ::tensorflow::Node* node() const { return table_handle.node(); }
49
50 Operation operation;
51 ::tensorflow::Output table_handle;
52};
53
54/// Creates an empty anonymous mutable hash table that uses tensors as the backing store.
55///
56/// This op creates a new anonymous mutable hash table (as a resource) everytime
57/// it is executed, with the specified dtype of its keys and values,
58/// returning the resource handle. Each value must be a scalar.
59/// Data can be inserted into the table using
60/// the insert operations. It does not support the initialization operation.
61///
62/// It uses "open addressing" with quadratic reprobing to resolve
63/// collisions.
64///
65/// The table is anonymous in the sense that it can only be
66/// accessed by the returned resource handle (e.g. it cannot be looked up
67/// by a name in a resource manager). The table will be automatically
68/// deleted when all resource handles pointing to it are gone.
69///
70/// Args:
71/// * scope: A Scope object
72/// * empty_key: The key used to represent empty key buckets internally. Must not
73/// be used in insert or lookup operations.
74/// * value_dtype: Type of the table values.
75///
76/// Optional attributes (see `Attrs`):
77/// * value_shape: The shape of each value.
78/// * initial_num_buckets: The initial number of hash table buckets. Must be a power
79/// to 2.
80/// * max_load_factor: The maximum ratio between number of entries and number of
81/// buckets before growing the table. Must be between 0 and 1.
82///
83/// Returns:
84/// * `Output`: The resource handle to the newly created hash-table resource.
85class AnonymousMutableDenseHashTable {
86 public:
87 /// Optional attribute setters for AnonymousMutableDenseHashTable
88 struct Attrs {
89 /// The shape of each value.
90 ///
91 /// Defaults to []
92 TF_MUST_USE_RESULT Attrs ValueShape(PartialTensorShape x) {
93 Attrs ret = *this;
94 ret.value_shape_ = x;
95 return ret;
96 }
97
98 /// The initial number of hash table buckets. Must be a power
99 /// to 2.
100 ///
101 /// Defaults to 131072
102 TF_MUST_USE_RESULT Attrs InitialNumBuckets(int64 x) {
103 Attrs ret = *this;
104 ret.initial_num_buckets_ = x;
105 return ret;
106 }
107
108 /// The maximum ratio between number of entries and number of
109 /// buckets before growing the table. Must be between 0 and 1.
110 ///
111 /// Defaults to 0.8
112 TF_MUST_USE_RESULT Attrs MaxLoadFactor(float x) {
113 Attrs ret = *this;
114 ret.max_load_factor_ = x;
115 return ret;
116 }
117
118 PartialTensorShape value_shape_ = {};
119 int64 initial_num_buckets_ = 131072;
120 float max_load_factor_ = 0.8f;
121 };
122 AnonymousMutableDenseHashTable(const ::tensorflow::Scope& scope,
123 ::tensorflow::Input empty_key,
124 ::tensorflow::Input deleted_key, DataType
125 value_dtype);
126 AnonymousMutableDenseHashTable(const ::tensorflow::Scope& scope,
127 ::tensorflow::Input empty_key,
128 ::tensorflow::Input deleted_key, DataType
129 value_dtype, const
130 AnonymousMutableDenseHashTable::Attrs& attrs);
131 operator ::tensorflow::Output() const { return table_handle; }
132 operator ::tensorflow::Input() const { return table_handle; }
133 ::tensorflow::Node* node() const { return table_handle.node(); }
134
135 static Attrs ValueShape(PartialTensorShape x) {
136 return Attrs().ValueShape(x);
137 }
138 static Attrs InitialNumBuckets(int64 x) {
139 return Attrs().InitialNumBuckets(x);
140 }
141 static Attrs MaxLoadFactor(float x) {
142 return Attrs().MaxLoadFactor(x);
143 }
144
145 Operation operation;
146 ::tensorflow::Output table_handle;
147};
148
149/// Creates an empty anonymous mutable hash table.
150///
151/// This op creates a new anonymous mutable hash table (as a resource) everytime
152/// it is executed, with the specified dtype of its keys and values,
153/// returning the resource handle. Each value must be a scalar.
154/// Data can be inserted into the table using
155/// the insert operations. It does not support the initialization operation.
156/// The table is anonymous in the sense that it can only be
157/// accessed by the returned resource handle (e.g. it cannot be looked up
158/// by a name in a resource manager). The table will be automatically
159/// deleted when all resource handles pointing to it are gone.
160///
161/// Args:
162/// * scope: A Scope object
163/// * key_dtype: Type of the table keys.
164/// * value_dtype: Type of the table values.
165///
166/// Returns:
167/// * `Output`: The resource handle to the newly created hash-table resource.
168class AnonymousMutableHashTable {
169 public:
170 AnonymousMutableHashTable(const ::tensorflow::Scope& scope, DataType key_dtype,
171 DataType value_dtype);
172 operator ::tensorflow::Output() const { return table_handle; }
173 operator ::tensorflow::Input() const { return table_handle; }
174 ::tensorflow::Node* node() const { return table_handle.node(); }
175
176 Operation operation;
177 ::tensorflow::Output table_handle;
178};
179
180/// Creates an empty anonymous mutable hash table of vector values.
181///
182/// This op creates a new anonymous mutable hash table (as a resource) everytime
183/// it is executed, with the specified dtype of its keys and values,
184/// returning the resource handle. Each value must be a vector.
185/// Data can be inserted into the table using
186/// the insert operations. It does not support the initialization operation.
187/// The table is anonymous in the sense that it can only be
188/// accessed by the returned resource handle (e.g. it cannot be looked up
189/// by a name in a resource manager). The table will be automatically
190/// deleted when all resource handles pointing to it are gone.
191///
192/// Args:
193/// * scope: A Scope object
194/// * key_dtype: Type of the table keys.
195/// * value_dtype: Type of the table values.
196///
197/// Returns:
198/// * `Output`: The resource handle to the newly created hash-table resource.
199class AnonymousMutableHashTableOfTensors {
200 public:
201 /// Optional attribute setters for AnonymousMutableHashTableOfTensors
202 struct Attrs {
203 /// Defaults to []
204 TF_MUST_USE_RESULT Attrs ValueShape(PartialTensorShape x) {
205 Attrs ret = *this;
206 ret.value_shape_ = x;
207 return ret;
208 }
209
210 PartialTensorShape value_shape_ = {};
211 };
212 AnonymousMutableHashTableOfTensors(const ::tensorflow::Scope& scope, DataType
213 key_dtype, DataType value_dtype);
214 AnonymousMutableHashTableOfTensors(const ::tensorflow::Scope& scope, DataType
215 key_dtype, DataType value_dtype, const
216 AnonymousMutableHashTableOfTensors::Attrs&
217 attrs);
218 operator ::tensorflow::Output() const { return table_handle; }
219 operator ::tensorflow::Input() const { return table_handle; }
220 ::tensorflow::Node* node() const { return table_handle.node(); }
221
222 static Attrs ValueShape(PartialTensorShape x) {
223 return Attrs().ValueShape(x);
224 }
225
226 Operation operation;
227 ::tensorflow::Output table_handle;
228};
229
230/// Removes keys and its associated values from a table.
231///
232/// The tensor `keys` must of the same type as the keys of the table. Keys not
233/// already in the table are silently ignored.
234///
235/// Args:
236/// * scope: A Scope object
237/// * table_handle: Handle to the table.
238/// * keys: Any shape. Keys of the elements to remove.
239///
240/// Returns:
241/// * the created `Operation`
242class LookupTableRemove {
243 public:
244 LookupTableRemove(const ::tensorflow::Scope& scope, ::tensorflow::Input
245 table_handle, ::tensorflow::Input keys);
246 operator ::tensorflow::Operation() const { return operation; }
247
248 Operation operation;
249};
250
251} // namespace internal
252} // namespace ops
253} // namespace tensorflow
254
255#endif // TENSORFLOW_CC_OPS_LOOKUP_OPS_INTERNAL_H_
256