class_docstr: Defines the ImageVAE model.
class_docstr_tok: ["Defines","the","ImageVAE","model","."]
code: def loss(self, logits, features):
      # logits should be dict with 'outputs', which is image.
      targets = tf.reshape(features["targets"], [-1, 64, 64, 1])
      weights = common_layers.weights_all(targets)
      loss_num = tf.pow(logits - targets, 2)
      return tf.reduce_sum(loss_num * weights), tf.reduce_sum(weights)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from magenta.models.image_stylization import ops
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
  import tensorflow_probability
label_desc: Use image node_id 4 for calling the ImageVAE obj's underlying member method code with example usage: obj.loss(logits, features) and returns: tf,  tf