code: def filter_empty_layer_containers(layer_list):
      """Filter out empty Layer-like containers and uniquify."""
      # TODO(b/130381733): Make this an attribute in base_layer.Layer.
      existing = set()
      to_visit = layer_list[::-1]
      while to_visit:
          obj = to_visit.pop()
          if id(obj) in existing:
              continue
          existing.add(id(obj))
          if hasattr(obj, "_is_layer") and not isinstance(obj, type):
              yield obj
          else:
              sub_layers = getattr(obj, "layers", None) or []
  
              # Trackable data structures will not show up in ".layers" lists, but
              # the layers they contain will.
              to_visit.extend(sub_layers[::-1])
  
file_path: tensorflow-upstream/tensorflow/python/keras/utils/layer_utils.py
imports: import functools
  import weakref
  import numpy
  from tensorflow.python.util import nest
label_desc: Use image node_id 8 for calling a global function with example usage: filter_empty_layer_containers(layer_list) without return types