class_docstr: Music Variational Autoencoder.
class_docstr_tok: ["Music","Variational","Autoencoder","."]
docstr: Train on the given sequences, returning an optimizer.
  
  Args:
    input_sequence: The sequence to be fed to the encoder.
    output_sequence: The sequence expected from the decoder.
    sequence_length: The length of the given sequences (which must be
        identical).
    control_sequence: (Optional) sequence on which to condition. This will be
        concatenated depthwise to the model inputs for both encoding and
        decoding.
  
  Returns:
    optimizer: A tf.train.Optimizer.
docstr_tok: ["Train","on","the","given","sequences",",","returning","an","optimizer",".","Args",":","input_sequence",":","The","sequence","to","be","fed","to","the","encoder",".","output_sequence",":","The","sequence","expected","from","the","decoder",".","sequence_length",":","The","length","of","the","given","sequences","(","which","must","be","identical",")",".","control_sequence",":","(","Optional",")","sequence","on","which","to","condition",".","This","will","be","concatenated","depthwise","to","the","model","inputs","for","both","encoding","and","decoding",".","Returns",":","optimizer",":","A","tf.train.Optimizer","."]
code: def train(
      self,
      input_sequence,
      output_sequence,
      sequence_length,
      control_sequence=None,
  ):
      """Train on the given sequences, returning an optimizer.
  
      Args:
        input_sequence: The sequence to be fed to the encoder.
        output_sequence: The sequence expected from the decoder.
        sequence_length: The length of the given sequences (which must be
            identical).
        control_sequence: (Optional) sequence on which to condition. This will be
            concatenated depthwise to the model inputs for both encoding and
            decoding.
  
      Returns:
        optimizer: A tf.train.Optimizer.
      """
  
      _, scalars_to_summarize = self._compute_model_loss(
          input_sequence,
          output_sequence,
          sequence_length,
          control_sequence,
      )
  
      hparams = self.hparams
      lr = (hparams.learning_rate - hparams.min_learning_rate) * tf.pow(
          hparams.decay_rate, tf.to_float(self.global_step)
      ) + hparams.min_learning_rate
  
      optimizer = tf.train.AdamOptimizer(lr)
  
      tf.summary.scalar("learning_rate", lr)
      for n, t in scalars_to_summarize.items():
          tf.summary.scalar(n, tf.reduce_mean(t))
  
      return optimizer
  
imports: import abc
  from magenta.contrib import training
  import tensorflow.compat.v1
  import tensorflow_probability
  import tf_slim
label_desc: Use image node_id 8 for calling the MusicVAE obj's underlying member method code with example usage: obj.train(input_sequence, output_sequence, sequence_length, control_sequence) and returns: optimizer