class_docstr: Base class for data converters for hierarchical sequences.
  
  Output sequences will be padded hierarchically and flattened if `max_lengths`
  is defined. For example, if `max_lengths = [3, 2, 4]`, `end_token=5`, and the
  underlying `_to_tensors` implementation returns an example
  (before one-hot conversion) [[[1, 5]], [[2, 3, 5]]], `to_tensors` will
  convert it to:
    `[[1, 5, 0, 0], [5, 0, 0, 0],
      [2, 3, 5, 0], [5, 0, 0, 0],
      [5, 0, 0, 0], [5, 0, 0, 0]]`
  If any of the lengths are beyond `max_lengths`, the tensor will be filtered.
  
  Inheriting classes must implement the following abstract methods:
    -`_to_tensors`
    -`_to_items`
class_docstr_tok: ["Base","class","for","data","converters","for","hierarchical","sequences",".","Output","sequences","will","be","padded","hierarchically","and","flattened","if","`","max_lengths","`","is","defined",".","For","example",",","if","`","max_lengths","=","[","3",",","2",",","4","]","`",",","`","end_token=5","`",",","and","the","underlying","`","_to_tensors","`","implementation","returns","an","example","(","before","one-hot","conversion",")","[","[","[","1",",","5","]","]",",","[","[","2",",","3",",","5","]","]","]",",","`","to_tensors","`","will","convert","it","to",":","`","[","[","1",",","5",",","0",",","0","]",",","[","5",",","0",",","0",",","0","]",",","[","2",",","3",",","5",",","0","]",",","[","5",",","0",",","0",",","0","]",",","[","5",",","0",",","0",",","0","]",",","[","5",",","0",",","0",",","0","]","]","`","If","any","of","the","lengths","are","beyond","`","max_lengths","`",",","the","tensor","will","be","filtered",".","Inheriting","classes","must","implement","the","following","abstract","methods",":","-","`","_to_tensors","`","-","`","_to_items","`"]
code: def __init__(
      self,
      input_depth,
      input_dtype,
      output_depth,
      output_dtype,
      control_depth=None,
      control_dtype=bool,
      control_pad_token=None,
      end_token=None,
      max_lengths=None,
      presplit_on_time_changes=True,
      max_tensors_per_notesequence=None,
      flat_output=False,
  ):
      self._control_pad_token = control_pad_token
      self._max_lengths = [] if max_lengths is None else max_lengths
      if max_lengths and not flat_output:
          length_shape = (np.prod(max_lengths[:-1]),)
      else:
          length_shape = ()
      super(BaseHierarchicalNoteSequenceConverter, self).__init__(
          input_depth=input_depth,
          input_dtype=input_dtype,
          output_depth=output_depth,
          output_dtype=output_dtype,
          control_depth=control_depth,
          control_dtype=control_dtype,
          end_token=end_token,
          max_tensors_per_notesequence=max_tensors_per_notesequence,
          length_shape=length_shape,
          presplit_on_time_changes=presplit_on_time_changes,
      )
  
imports: import abc
  import random
  from magenta.models.music_vae import data
  from magenta.pipelines import performance_pipeline
  import note_seq
  from note_seq import chords_lib
  from note_seq import performance_lib
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 1 to create a new BaseHierarchicalNoteSequenceConverter object from inherited base classes: data with example: obj = BaseHierarchicalNoteSequenceConverter(input_depth, input_dtype, output_depth, output_dtype, control_depth, control_dtype, control_pad_token, end_token, max_lengths, presplit_on_time_changes, max_tensors_per_notesequence, flat_output)