parameters: (layers)
return_statement: return metrics
docstring: Returns list of metrics from the given layers.
  
    This will not include the `compile` metrics of a model layer.
  
    Arguments:
      layers: List of layers.
  
    Returns:
      List of metrics.
docstring_summary: Returns list of metrics from the given layers.
docstring_tokens: Returns list of metrics from the given layers .
function: def _get_metrics_from_layers(layers):
    """Returns list of metrics from the given layers.
  
    This will not include the `compile` metrics of a model layer.
  
    Arguments:
      layers: List of layers.
  
    Returns:
      List of metrics.
    """
    metrics = []
    layers = trackable_layer_utils.filter_empty_layer_containers(layers)
    for layer in layers:
      if isinstance(layer, Model):
        # We cannot call 'metrics' on the model because we do not want to
        # include the metrics that were added in compile API of a nested model.
        metrics.extend(layer._metrics)  # pylint: disable=protected-access
        metrics.extend(_get_metrics_from_layers(layer.layers))
      else:
        metrics.extend(layer.metrics)
    return metrics
function_tokens: def _get_metrics_from_layers ( layers ) : metrics = [ ] layers = trackable_layer_utils . filter_empty_layer_containers ( layers ) for layer in layers : if isinstance ( layer , Model ) : # We cannot call 'metrics' on the model because we do not want to # include the metrics that were added in compile API of a nested model. metrics . extend ( layer . _metrics ) # pylint: disable=protected-access metrics . extend ( _get_metrics_from_layers ( layer . layers ) ) else : metrics . extend ( layer . metrics ) return metrics