code: def pitch_embeddings(
      batch, timesteps=1, n_pitches=128, dim_embedding=128, reuse=False
  ):
      """Get a embedding of each pitch note.
  
      Args:
        batch: NSynthDataset batch dictionary.
        timesteps: Number of timesteps to replicate across.
        n_pitches: Number of one-hot embeddings.
        dim_embedding: Dimension of linear projection of one-hot encoding.
        reuse: Reuse variables.
  
      Returns:
        embedding: A tensor of shape [batch_size, 1, timesteps, dim_embedding].
      """
      batch_size = batch["pitch"].get_shape().as_list()[0]
      with tf.variable_scope("PitchEmbedding", reuse=reuse):
          w = tf.get_variable(
              name="embedding_weights",
              shape=[n_pitches, dim_embedding],
              initializer=tf.random_normal_initializer(),
          )
          one_hot_pitch = tf.reshape(batch["pitch"], [batch_size])
          one_hot_pitch = tf.one_hot(one_hot_pitch, depth=n_pitches)
          embedding = tf.matmul(one_hot_pitch, w)
          embedding = tf.reshape(
              embedding, [batch_size, 1, 1, dim_embedding]
          )
          if timesteps > 1:
              embedding = tf.tile(embedding, [1, 1, timesteps, 1])
          return embedding
  
imports: import importlib
  import os
  import librosa
  import numpy
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 24 for calling a global function with example usage: pitch_embeddings(batch, timesteps, n_pitches, dim_embedding, reuse) and returns: embedding