class_docstr: Defines the ImageVAE model.
class_docstr_tok: ["Defines","the","ImageVAE","model","."]
code: def visual_encoder(self, inputs, clss, hparams, train):
      del train
      # goes from [batch, 64, 64, 1] to [batch, hidden_size]
      with tf.variable_scope("visual_encoder", reuse=tf.AUTO_REUSE):
          ret = inputs
          clss = tf.reshape(clss, [-1])
  
          # conv layer, followed by instance norm + FiLM
          ret = tf.layers.Conv2D(
              hparams.base_depth, 5, 1, padding="SAME", activation=None
          )(ret)
          ret = ops.conditional_instance_norm(
              ret, clss, hparams.num_categories
          )
          ret = tf.nn.relu(ret)
  
          ret = tf.layers.Conv2D(
              hparams.base_depth, 5, 2, padding="SAME", activation=None
          )(ret)
          ret = ops.conditional_instance_norm(
              ret, clss, hparams.num_categories
          )
          ret = tf.nn.relu(ret)
  
          ret = tf.layers.Conv2D(
              2 * hparams.base_depth,
              5,
              1,
              padding="SAME",
              activation=None,
          )(ret)
          ret = ops.conditional_instance_norm(
              ret, clss, hparams.num_categories
          )
          ret = tf.nn.relu(ret)
  
          ret = tf.layers.Conv2D(
              2 * hparams.base_depth,
              5,
              2,
              padding="SAME",
              activation=None,
          )(ret)
          ret = ops.conditional_instance_norm(
              ret, clss, hparams.num_categories
          )
          ret = tf.nn.relu(ret)
  
          # new conv layer, to bring shape down
          ret = tf.layers.Conv2D(
              2 * hparams.bottleneck_bits,
              4,
              2,
              padding="SAME",
              activation=None,
          )(ret)
          ret = ops.conditional_instance_norm(
              ret, clss, hparams.num_categories
          )
          ret = tf.nn.relu(ret)
  
          # new conv layer, to bring shape down
          ret = tf.layers.Conv2D(
              2 * hparams.bottleneck_bits,
              4,
              2,
              padding="SAME",
              activation=None,
          )(ret)
          ret = ops.conditional_instance_norm(
              ret, clss, hparams.num_categories
          )
          ret = tf.nn.relu(ret)
  
          # ret has 1024
          ret = tf.layers.flatten(ret)
          ret = tf.layers.dense(
              ret, 2 * hparams.bottleneck_bits, activation=None
          )
  
      return ret
  
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 7 for calling the ImageVAE obj's underlying member method code with example usage: obj.visual_encoder(inputs, clss, hparams, train) and returns: ret