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

Function _add_elements_to_collection

tensorflow/python/layers/base.py:598–610  ·  view source on GitHub ↗
(elements, collection_list)

Source from the content-addressed store, hash-verified

596
597
598def _add_elements_to_collection(elements, collection_list):
599 if context.executing_eagerly():
600 raise RuntimeError('Using collections from Layers not supported in Eager '
601 'mode. Tried to add %s to %s' % (elements,
602 collection_list))
603 elements = nest.flatten(elements)
604 collection_list = nest.flatten(collection_list)
605 for name in collection_list:
606 collection = ops.get_collection_ref(name)
607 collection_set = object_identity.ObjectIdentitySet(collection)
608 for element in elements:
609 if element not in collection_set:
610 collection.append(element)

Callers 2

add_lossMethod · 0.85
__call__Method · 0.85

Calls 4

executing_eagerlyMethod · 0.80
get_collection_refMethod · 0.80
flattenMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected