class_docstr: Defines the GlyphAzznProblem class.
class_docstr_tok: ["Defines","the","GlyphAzznProblem","class","."]
docstr: Time series are flat on disk, we un-flatten them back here.
docstr_tok: ["Time","series","are","flat","on","disk",",","we","un-flatten","them","back","here","."]
code: def preprocess_example(self, example, unused_mode, hparams):
      """Time series are flat on disk, we un-flatten them back here."""
      if not hasattr(self, "mean_npz"):
          mean_filename = os.path.join(hparams.data_dir, "mean.npz")
          stdev_filename = os.path.join(hparams.data_dir, "stdev.npz")
          with tf.gfile.Open(mean_filename, "r") as f:
              self.mean_npz = np.load(f)
          with tf.gfile.Open(stdev_filename, "r") as f:
              self.stdev_npz = np.load(f)
  
      example["targets_cls"] = tf.reshape(example["targets_cls"], [1])
      example["targets_sln"] = tf.reshape(example["targets_sln"], [1])
  
      example["targets_rel"] = tf.reshape(
          example["targets_rel"], [51, 1, 10]
      )
      # normalize (via gaussian)
      example["targets_rel"] = (
          example["targets_rel"] - self.mean_npz
      ) / self.stdev_npz
  
      # redefine shape inside model!
      example["targets_psr"] = (
          tf.reshape(example["targets_rnd"], [1, 64 * 64]) / 255.0
      )
      del example["targets_rnd"]
  
      if hparams.just_render:
          # training vae mode, use the last image (rendered icon) as input & output
          example["inputs"] = example["targets_psr"][-1, :]
          example["targets"] = example["targets_psr"][-1, :]
      else:
          example["inputs"] = tf.identity(example["targets_rel"])
          example["targets"] = tf.identity(example["targets_rel"])
  
      return example
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl import logging
  from magenta.models.svg_vae import svg_utils
  import numpy
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import problem
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import modalities
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 12 for calling the GlyphAzznProblem obj's underlying member method code with example usage: obj.preprocess_example(example, unused_mode, hparams) and returns: example