class_docstr: Helper functions to compute specgrams.
class_docstr_tok: ["Helper","functions","to","compute","specgrams","."]
docstr: Converts melspecgrams to specgrams.
  
  Args:
    melspecgrams: Tensor of log magnitudes and instantaneous frequencies,
      shape [batch, time, freq, 2], mel scaling of frequencies.
  
  Returns:
    specgrams: Tensor of log magnitudes and instantaneous frequencies,
      shape [batch, time, freq, 2].
docstr_tok: ["Converts","melspecgrams","to","specgrams",".","Args",":","melspecgrams",":","Tensor","of","log","magnitudes","and","instantaneous","frequencies",",","shape","[","batch",",","time",",","freq",",","2","]",",","mel","scaling","of","frequencies",".","Returns",":","specgrams",":","Tensor","of","log","magnitudes","and","instantaneous","frequencies",",","shape","[","batch",",","time",",","freq",",","2","]","."]
code: def melspecgrams_to_specgrams(self, melspecgrams):
      """Converts melspecgrams to specgrams.
  
      Args:
        melspecgrams: Tensor of log magnitudes and instantaneous frequencies,
          shape [batch, time, freq, 2], mel scaling of frequencies.
  
      Returns:
        specgrams: Tensor of log magnitudes and instantaneous frequencies,
          shape [batch, time, freq, 2].
      """
      if self._mel_downscale is None:
          return melspecgrams
  
      logmelmag2 = melspecgrams[:, :, :, 0]
      mel_p = melspecgrams[:, :, :, 1]
  
      mel2l = tf.to_float(self._mel_to_linear_matrix())
      mag2 = tf.tensordot(tf.exp(logmelmag2), mel2l, 1)
      logmag = 0.5 * self._safe_log(mag2)
      mel_phase_angle = tf.cumsum(mel_p * np.pi, axis=-2)
      phase_angle = tf.tensordot(mel_phase_angle, mel2l, 1)
      p = spectral_ops.instantaneous_frequency(phase_angle)
  
      return tf.concat(
          [logmag[:, :, :, tf.newaxis], p[:, :, :, tf.newaxis]], axis=-1
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from magenta.models.gansynth.lib import spectral_ops
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 12 for calling the SpecgramsHelper obj's underlying member method code with example usage: obj.melspecgrams_to_specgrams(melspecgrams) and returns: tf, melspecgrams