MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / get_uid

Function get_uid

tensorflow/python/keras/backend.py:185–208  ·  view source on GitHub ↗

Associates a string prefix with an integer counter in a TensorFlow graph. Arguments: prefix: String prefix to index. Returns: Unique integer ID. Example: ``` >>> get_uid('dense') 1 >>> get_uid('dense') 2 ```

(prefix='')

Source from the content-addressed store, hash-verified

183
184@keras_export('keras.backend.get_uid')
185def get_uid(prefix=''):
186 """Associates a string prefix with an integer counter in a TensorFlow graph.
187
188 Arguments:
189 prefix: String prefix to index.
190
191 Returns:
192 Unique integer ID.
193
194 Example:
195
196 ```
197 >>> get_uid('dense')
198 1
199 >>> get_uid('dense')
200 2
201 ```
202 """
203 graph = get_graph()
204 if graph not in PER_GRAPH_OBJECT_NAME_UIDS:
205 PER_GRAPH_OBJECT_NAME_UIDS[graph] = collections.defaultdict(int)
206 layer_name_uids = PER_GRAPH_OBJECT_NAME_UIDS[graph]
207 layer_name_uids[prefix] += 1
208 return layer_name_uids[prefix]
209
210
211@keras_export('keras.backend.reset_uids')

Callers

nothing calls this directly

Calls 1

get_graphFunction · 0.85

Tested by

no test coverage detected