def _get_snr_metrics_dict(signal_names,
                          separated_waveforms,
                          source_waveforms,
                          mixture_waveforms,
                          metric_functions):
  """Computes dict of SNR metrics.

  Args:
    signal_names: List of signal names for which to compute summaries.
    separated_waveforms: The separated signals, of shape
        (batch, source, time).
    source_waveforms: The source signals (training targets), of shape
        (batch, source, time).
    mixture_waveforms: The mixture input signals, of shape
        (batch, mic, time).
    metric_functions: A dict of string->function pairs mapping metric name to
        metric function with signature metric_fn(estimated, source).

  Returns:
    A dict of string->tf.Tensor pairs mapping metric name to metric values.
  """
  metrics_dict = {}
  for k, signal_name in enumerate(signal_names):
    for metric_name, metric_fn in metric_functions.items():
      mixture = metric_fn(mixture_waveforms[:, 0], source_waveforms[:, k])
      separated = metric_fn(separated_waveforms[:, k], source_waveforms[:, k])
      improv = separated - mixture
      metrics_dict['SNR/%s/mixture_%s' % (metric_name, signal_name)] = mixture
      metrics_dict[
          'SNR/%s/separated_%s' % (metric_name, signal_name)] = separated
      metrics_dict[
          'SNR/%s/improvement_%s' % (metric_name, signal_name)] = improv

  return metrics_dict