(self, legacy_hparams, dikt)
Check that all the pitch range related hparams match each other.
Check that all the pitch range related hparams match each other.
Check that all the pitch range related hparams match each other .
def _check_pitch_range_compatibilities(self, legacy_hparams, dikt):
    """Check that all the pitch range related hparams match each other."""
    min_pitch = dikt.get('min_pitch', self.min_pitch)
    max_pitch = dikt.get('max_pitch', self.max_pitch)
    if 'pitch_ranges' in legacy_hparams:
      for legacy_pitch, given_pitch in zip(
          legacy_hparams['pitch_ranges'], [min_pitch, max_pitch]):
        if legacy_pitch != given_pitch:
          raise ValueError(
              'Legacy pitch range element %d does not match given '
              'pitch %d.' % (
                  legacy_pitch, given_pitch))
    if 'num_pitches' in legacy_hparams:
      computed_num_pitches = max_pitch - min_pitch + 1
      legacy_num_pitches = legacy_hparams['num_pitches']
      if legacy_num_pitches != computed_num_pitches:
        raise ValueError(
            'num_pitches %d is not compatible with that computed from '
            'min_pitch %d and max_pitch %d, which is %d.' % (
                legacy_num_pitches, min_pitch, max_pitch,
                computed_num_pitches))
def _check_pitch_range_compatibilities ( self , legacy_hparams , dikt ) : min_pitch = dikt . get ( 'min_pitch' , self . min_pitch ) max_pitch = dikt . get ( 'max_pitch' , self . max_pitch ) if 'pitch_ranges' in legacy_hparams : for legacy_pitch , given_pitch in zip ( legacy_hparams [ 'pitch_ranges' ] , [ min_pitch , max_pitch ] ) : if legacy_pitch != given_pitch : raise ValueError ( 'Legacy pitch range element %d does not match given ' 'pitch %d.' % ( legacy_pitch , given_pitch ) ) if 'num_pitches' in legacy_hparams : computed_num_pitches = max_pitch - min_pitch + 1 legacy_num_pitches = legacy_hparams [ 'num_pitches' ] if legacy_num_pitches != computed_num_pitches : raise ValueError ( 'num_pitches %d is not compatible with that computed from ' 'min_pitch %d and max_pitch %d, which is %d.' % ( legacy_num_pitches , min_pitch , max_pitch , computed_num_pitches ) )