class_docstr: Helper functions to compute specgrams.
class_docstr_tok: ["Helper","functions","to","compute","specgrams","."]
docstr: Converts stfts to specgrams.
  
  Args:
    stfts: Complex64 tensor of stft, shape [batch, time, freq, 1].
  
  Returns:
    specgrams: Tensor of log magnitudes and instantaneous frequencies,
      shape [batch, time, freq, 2].
docstr_tok: ["Converts","stfts","to","specgrams",".","Args",":","stfts",":","Complex64","tensor","of","stft",",","shape","[","batch",",","time",",","freq",",","1","]",".","Returns",":","specgrams",":","Tensor","of","log","magnitudes","and","instantaneous","frequencies",",","shape","[","batch",",","time",",","freq",",","2","]","."]
code: def stfts_to_specgrams(self, stfts):
      """Converts stfts to specgrams.
  
      Args:
        stfts: Complex64 tensor of stft, shape [batch, time, freq, 1].
  
      Returns:
        specgrams: Tensor of log magnitudes and instantaneous frequencies,
          shape [batch, time, freq, 2].
      """
      stfts = stfts[:, :, :, 0]
  
      logmag = self._safe_log(tf.abs(stfts))
  
      phase_angle = tf.angle(stfts)
      if self._ifreq:
          p = spectral_ops.instantaneous_frequency(phase_angle)
      else:
          p = phase_angle / np.pi
  
      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 7 for calling the SpecgramsHelper obj's underlying member method code with example usage: obj.stfts_to_specgrams(stfts) and returns: tf