code: def testInstantaneousFrequency(self, shape, axis):
      # Instantaneous Frequency in numpy
      phase_np = np.pi * (2 * np.random.rand(*shape) - 1)
      unwrapped_np = np.unwrap(phase_np, axis=axis)
      dphase_np = np.diff(unwrapped_np, axis=axis)
      # Append with initial phase
      s = [
          slice(None),
      ] * unwrapped_np.ndim
      s[axis] = slice(0, 1)
      slice_np = unwrapped_np[tuple(s)]
      dphase_np = (
          np.concatenate([slice_np, dphase_np], axis=axis) / np.pi
      )
  
      phase_tf = tf.convert_to_tensor(phase_np)
      with self.cached_session() as sess:
          dphase_tf = sess.run(
              spectral_ops.instantaneous_frequency(
                  phase_tf, time_axis=axis
              )
          )
      self.assertAllClose(dphase_np, dphase_tf)
  
file_path: magenta/magenta/models/gansynth/lib/spectral_ops_test.py
imports: from absl.testing import parameterized
  from magenta.models.gansynth.lib import spectral_ops
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling the SpectralOpsTest obj's underlying member method code with example usage: obj.testInstantaneousFrequency(shape, axis) without return types