class_docstr: Allen Brain Atlas histology dataset.
  
  See also: http://help.brain-map.org/
  
  Notes:
  
    * 64px to 64px identity mapping problem, no in-painting.
class_docstr_tok: ["Allen","Brain","Atlas","histology","dataset",".","See","also",":","http",":","\/\/help.brain-map.org\/","Notes",":","*","64px","to","64px","identity","mapping","problem",",","no","in-painting","."]
code: def preprocess_example(self, example, mode, hparams):
      # Crop to target shape instead of down-sampling target, leaving target
      # of maximum available resolution.
      target_shape = (
          self.output_dim,
          self.output_dim,
          self.num_channels,
      )
      example["targets"] = tf.random_crop(
          example["targets"], target_shape
      )
  
      example["inputs"] = image_utils.resize_by_area(
          example["targets"], self.input_dim
      )
  
      if (
          self.inpaint_fraction is not None
          and self.inpaint_fraction > 0
      ):
          mask = random_square_mask(
              (self.input_dim, self.input_dim, self.num_channels),
              self.inpaint_fraction,
          )
  
          example["inputs"] = tf.multiply(
              tf.convert_to_tensor(mask, dtype=tf.int64),
              example["inputs"],
          )
  
          if self.input_dim is None:
              raise ValueError(
                  "Cannot train in-painting for examples with "
                  "only targets (i.e. input_dim is None, "
                  "implying there are only targets to be "
                  "generated)."
              )
  
      return example
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from io import BytesIO
  import math
  import os
  import numpy
  import requests
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import image_utils
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.layers import modalities
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import metrics
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 8 for calling the Img2imgAllenBrain obj's underlying member method code with example usage: obj.preprocess_example(example, mode, hparams) and returns: example