class_docstr: Apache Beam accumulator to compute the mean/stdev of svg commands.
class_docstr_tok: ["Apache","Beam","accumulator","to","compute","the","mean\/stdev","of","svg","commands","."]
code: def extract_output(self, sum_count):
      (curr_sum, curr_sum_sq, count) = sum_count
      if count:
          mean = np.divide(curr_sum, count)
          variance = np.divide(curr_sum_sq, count) - np.power(mean, 2)
          # -ve value could happen due to rounding
          variance = np.max(
              [variance, np.zeros(np.shape(variance))], axis=0
          )
          stddev = np.sqrt(variance)
          return {
              "mean": mean,
              "variance": variance,
              "stddev": stddev,
              "count": count,
          }
      else:
          return {
              "mean": float("NaN"),
              "variance": float("NaN"),
              "stddev": float("NaN"),
              "count": 0,
          }
  
imports: from absl import app
  from absl import flags
  import apache_beam
  from magenta.models.svg_vae import svg_utils
  import numpy
  from tensor2tensor.data_generators import generator_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling the MeanStddev obj's underlying member method code with example usage: obj.extract_output(sum_count) and returns: dict, dict