(layers)
return layers
Ensures that layers is a single flat list of Layer instances.
Ensures that layers is a single flat list of Layer instances.
Ensures that layers is a single flat list of Layer instances .
def _ensure_flat(layers):
  """Ensures that layers is a single flat list of Layer instances."""
  if len(layers) == 1 and layers[0] is None:
    layers = ()
  else:
    layers = _deep_flatten(layers)
  for obj in layers:
    if not isinstance(obj, tl.Layer):
      raise ValueError(
          f'Found nonlayer object ({obj}) in layers: {layers}')
  return layers
def _ensure_flat ( layers ) : if len ( layers ) == 1 and layers [ 0 ] is None : layers = ( ) else : layers = _deep_flatten ( layers ) for obj in layers : if not isinstance ( obj , tl . Layer ) : raise ValueError ( f'Found nonlayer object ({obj}) in layers: {layers}' ) return layers