(filepattern, output_path)
return pipeline
Computes the Mean and Std across examples in glyphazzn dataset.
Computes the Mean and Std across examples in glyphazzn dataset.
Computes the Mean and Std across examples in glyphazzn dataset .
def get_stats_of_glyphazzn(filepattern, output_path):
  """Computes the Mean and Std across examples in glyphazzn dataset."""
  def pipeline(root):
    """Pipeline for computing means/std from dataset."""
    examples = root | 'Read' >> beam.io.tfrecordio.ReadFromTFRecord(filepattern)
    examples = examples | 'Deserialize' >> beam.Map(_decode_tfexample)
    examples = examples | 'GetMeanStdev' >> beam.CombineGlobally(MeanStddev())
    examples = examples | 'MeanStdevToSerializedTFRecord' >> beam.Map(
        _mean_to_example)
    (examples | 'WriteToTFRecord' >> beam.io.tfrecordio.WriteToTFRecord(
        output_path, coder=beam.coders.ProtoCode(tf.train.Example)))
  return pipeline
def get_stats_of_glyphazzn ( filepattern , output_path ) : def pipeline ( root ) : """Pipeline for computing means/std from dataset.""" examples = root | 'Read' >> beam . io . tfrecordio . ReadFromTFRecord ( filepattern ) examples = examples | 'Deserialize' >> beam . Map ( _decode_tfexample ) examples = examples | 'GetMeanStdev' >> beam . CombineGlobally ( MeanStddev ( ) ) examples = examples | 'MeanStdevToSerializedTFRecord' >> beam . Map ( _mean_to_example ) ( examples | 'WriteToTFRecord' >> beam . io . tfrecordio . WriteToTFRecord ( output_path , coder = beam . coders . ProtoCode ( tf . train . Example ) ) ) return pipeline