(self, min_hop_size_seconds, max_hop_size_seconds,
               num_replications, encode_performance_fn, encode_score_fns,
               augment_fns, absolute_timing, random_crop_length,
               *unused_args, **unused_kwargs)
Initialize an ExtractExamplesDoFn.

    If any of the `encode_score_fns` or `encode_performance_fn` returns an empty
    encoding for a particular example, the example will be discarded.

    Args:
      min_hop_size_seconds: Minimum hop size in seconds at which input
          NoteSequence protos can be split.
      max_hop_size_seconds: Maximum hop size in seconds at which input
          NoteSequence protos can be split. If zero or None, will not split at
          all.
      num_replications: Number of times input NoteSequence protos will be
          replicated prior to splitting.
      encode_performance_fn: Performance encoding function. Will be applied to
          the performance NoteSequence and the resulting encoding will be stored
          as 'targets' in each example.
      encode_score_fns: Optional dictionary of named score encoding functions.
          If provided, each function will be applied to the score NoteSequence
          and the resulting encodings will be stored in each example.
      augment_fns: Optional list of data augmentation functions. If provided,
          each function will be applied to each performance NoteSequence (and
          score, when using scores), creating a separate example per
          augmentation function. Should not modify the NoteSequence.
      absolute_timing: If True, each score will use absolute instead of tempo-
          relative timing. Since chord inference depends on having beats, the
          score will only contain melody.
      random_crop_length: If specified, crop each encoded performance
          ('targets') to this length.

    Raises:
      ValueError: If the maximum hop size is less than twice the minimum hop
          size, or if `encode_score_fns` and `random_crop_length` are both
          specified.
Initialize an ExtractExamplesDoFn.
Initialize an ExtractExamplesDoFn .
def __init__(self, min_hop_size_seconds, max_hop_size_seconds,
               num_replications, encode_performance_fn, encode_score_fns,
               augment_fns, absolute_timing, random_crop_length,
               *unused_args, **unused_kwargs):
    """Initialize an ExtractExamplesDoFn.

    If any of the `encode_score_fns` or `encode_performance_fn` returns an empty
    encoding for a particular example, the example will be discarded.

    Args:
      min_hop_size_seconds: Minimum hop size in seconds at which input
          NoteSequence protos can be split.
      max_hop_size_seconds: Maximum hop size in seconds at which input
          NoteSequence protos can be split. If zero or None, will not split at
          all.
      num_replications: Number of times input NoteSequence protos will be
          replicated prior to splitting.
      encode_performance_fn: Performance encoding function. Will be applied to
          the performance NoteSequence and the resulting encoding will be stored
          as 'targets' in each example.
      encode_score_fns: Optional dictionary of named score encoding functions.
          If provided, each function will be applied to the score NoteSequence
          and the resulting encodings will be stored in each example.
      augment_fns: Optional list of data augmentation functions. If provided,
          each function will be applied to each performance NoteSequence (and
          score, when using scores), creating a separate example per
          augmentation function. Should not modify the NoteSequence.
      absolute_timing: If True, each score will use absolute instead of tempo-
          relative timing. Since chord inference depends on having beats, the
          score will only contain melody.
      random_crop_length: If specified, crop each encoded performance
          ('targets') to this length.

    Raises:
      ValueError: If the maximum hop size is less than twice the minimum hop
          size, or if `encode_score_fns` and `random_crop_length` are both
          specified.
    """
    if (max_hop_size_seconds and
        max_hop_size_seconds != min_hop_size_seconds and
        max_hop_size_seconds < 2 * min_hop_size_seconds):
      raise ValueError(
          'Maximum hop size must be at least twice minimum hop size.')

    if encode_score_fns and random_crop_length:
      raise ValueError('Cannot perform random crop when scores are used.')

    super(ExtractExamplesDoFn, self).__init__(*unused_args, **unused_kwargs)
    self._min_hop_size_seconds = min_hop_size_seconds
    self._max_hop_size_seconds = max_hop_size_seconds
    self._num_replications = num_replications
    self._encode_performance_fn = encode_performance_fn
    self._encode_score_fns = encode_score_fns
    self._augment_fns = augment_fns if augment_fns else [lambda ns: ns]
    self._absolute_timing = absolute_timing
    self._random_crop_length = random_crop_length
def __init__ ( self , min_hop_size_seconds , max_hop_size_seconds , num_replications , encode_performance_fn , encode_score_fns , augment_fns , absolute_timing , random_crop_length , * unused_args , * * unused_kwargs ) : if ( max_hop_size_seconds and max_hop_size_seconds != min_hop_size_seconds and max_hop_size_seconds < 2 * min_hop_size_seconds ) : raise ValueError ( 'Maximum hop size must be at least twice minimum hop size.' ) if encode_score_fns and random_crop_length : raise ValueError ( 'Cannot perform random crop when scores are used.' ) super ( ExtractExamplesDoFn , self ) . __init__ ( * unused_args , * * unused_kwargs ) self . _min_hop_size_seconds = min_hop_size_seconds self . _max_hop_size_seconds = max_hop_size_seconds self . _num_replications = num_replications self . _encode_performance_fn = encode_performance_fn self . _encode_score_fns = encode_score_fns self . _augment_fns = augment_fns if augment_fns else [ lambda ns : ns ] self . _absolute_timing = absolute_timing self . _random_crop_length = random_crop_length