class_docstr: API for writing serialized data statistics to TFRecord file.
class_docstr_tok: ["API","for","writing","serialized","data","statistics","to","TFRecord","file","."]
code: def expand(self, stats: beam.PCollection) -> beam.pvalue.PDone:
      return stats | "WriteStats" >> beam.io.WriteToTFRecord(
          self._output_path,
          shard_name_template="" if not self._sharded_output else None,
          coder=beam.coders.ProtoCoder(
              statistics_pb2.DatasetFeatureStatisticsList
          ),
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import random
  from typing import Generator, Text, Optional
  import apache_beam
  import pyarrow
  from tensorflow_data_validation.utils import artifacts_io_impl
  from tensorflow_data_validation.statistics import stats_impl
  from tensorflow_data_validation.statistics import stats_options
  from tfx_bsl.statistics import merge_util
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 2 for calling the WriteStatisticsToTFRecord obj's underlying member method code with example usage: obj.expand(stats) and returns: unknown