class_docstr: Conditional image generation with attention. See file docstring.
class_docstr_tok: ["Conditional","image","generation","with","attention",".","See","file","docstring","."]
code: def body(self, features):
      hparams = copy.copy(self._hparams)
      inputs = features["inputs"]
      targets = features["targets"]
      targets_shape = common_layers.shape_list(targets)
      if not (
          tf.get_variable_scope().reuse
          or hparams.mode == tf_estimator.ModeKeys.PREDICT
      ):
          tf.summary.image("targets", targets, max_outputs=1)
  
      decoder_input, rows, cols = cia.prepare_decoder(targets, hparams)
      # Add class label to decoder input.
      if not hparams.unconditional:
          decoder_input += tf.reshape(
              inputs, [targets_shape[0], 1, 1, hparams.hidden_size]
          )
  
      decoder_output = cia.transformer_decoder_layers(
          decoder_input,
          None,
          hparams.num_decoder_layers,
          hparams,
          attention_type=hparams.dec_attention_type,
          name="decoder",
      )
  
      output = cia.create_output(
          decoder_output, rows, cols, targets, hparams
      )
      return output
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import numpy
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import common_image_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import modalities
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 1 for calling the Imagetransformer2d obj's underlying member method code with example usage: obj.body(features) and returns: output