(rl_tuner, action, stat_dict)
return stat_dict
Updates stat dict if a melodic leap was just made or resolved.

  Args:
    rl_tuner: An RLTuner object.
    action: One-hot encoding of the chosen action.
    stat_dict: A dictionary containing fields for statistics about
      compositions.
  Returns:
    A dictionary of composition statistics with leap-related fields updated.
Updates stat dict if a melodic leap was just made or resolved.
Updates stat dict if a melodic leap was just made or resolved .
def add_leap_stats(rl_tuner, action, stat_dict):
  """Updates stat dict if a melodic leap was just made or resolved.

  Args:
    rl_tuner: An RLTuner object.
    action: One-hot encoding of the chosen action.
    stat_dict: A dictionary containing fields for statistics about
      compositions.
  Returns:
    A dictionary of composition statistics with leap-related fields updated.
  """
  leap_outcome = rl_tuner.detect_leap_up_back(action)
  if leap_outcome == rl_tuner_ops.LEAP_RESOLVED:
    stat_dict['num_resolved_leaps'] += 1
  elif leap_outcome == rl_tuner_ops.LEAP_DOUBLED:
    stat_dict['num_leap_twice'] += 1
  return stat_dict
def add_leap_stats ( rl_tuner , action , stat_dict ) : leap_outcome = rl_tuner . detect_leap_up_back ( action ) if leap_outcome == rl_tuner_ops . LEAP_RESOLVED : stat_dict [ 'num_resolved_leaps' ] += 1 elif leap_outcome == rl_tuner_ops . LEAP_DOUBLED : stat_dict [ 'num_leap_twice' ] += 1 return stat_dict