class_docstr: A dataset for reading NSynth from Tensorflow Datasets (TFDS).
class_docstr_tok: ["A","dataset","for","reading","NSynth","from","Tensorflow","Datasets","(","TFDS",")","."]
docstr: Provides one hot labels.
docstr_tok: ["Provides","one","hot","labels","."]
code: def provide_one_hot_labels(self, batch_size):
      """Provides one hot labels."""
      pitch_counts = self.get_pitch_counts()
      pitches = sorted(pitch_counts.keys())
      counts = [pitch_counts[p] for p in pitches]
      indices = tf.reshape(
          tf.multinomial(tf.log([tf.to_float(counts)]), batch_size),
          [batch_size],
      )
      one_hot_labels = tf.one_hot(indices, depth=len(pitches))
      return one_hot_labels
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from magenta.models.gansynth.lib import spectral_ops
  import numpy
  import tensorflow.compat.v1
  import tensorflow_datasets
label_desc: Use image node_id 2 for calling the NSynthTfdsDataset obj's underlying member method code with example usage: obj.provide_one_hot_labels(batch_size) and returns: one_hot_labels