class_docstr: Beam PTransform that reads NoteSequence protos from TFRecord.
class_docstr_tok: ["Beam","PTransform","that","reads","NoteSequence","protos","from","TFRecord","."]
code: def expand(self, pcoll):
      # Awkward to use ReadAllFromTFRecord instead of ReadFromTFRecord here,
      # but for some reason ReadFromTFRecord doesn't work with gs:// URLs.
      pcoll |= beam.Create([self._tfrecord_path])
      pcoll |= beam.io.tfrecordio.ReadAllFromTFRecord()
      pcoll |= beam.Map(
          lambda ns_str: (
              note_seq.NoteSequence.FromString(ns_str).id,
              ns_str,
          )
      )
      return pcoll
  
imports: import copy
  import functools
  import hashlib
  import logging
  import os
  import random
  import typing
  import apache_beam
  from apache_beam import typehints
  from apache_beam.metrics import Metrics
  from magenta.models.score2perf import music_encoders
  import note_seq
  from note_seq import chord_inference
  from note_seq import melody_inference
  from note_seq import sequences_lib
  import numpy
  from tensor2tensor.data_generators import generator_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the ReadNoteSequencesFromTFRecord obj's underlying member method code with example usage: obj.expand(pcoll) and returns: pcoll