(elements, collection_list)
| 596 | |
| 597 | |
| 598 | def _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) |
no test coverage detected