code: def van_enc_2d(x, first_depth, reuse=False):
      """The higher level structure encoder for the VAN.
  
      The high level structure is a vector instead of an image.
  
      Args:
        x: The higher level structure to encode.
        first_depth: The depth of the first layer. Depth is increased in subsequent
          layers.
        reuse: To reuse in variable scope or not.
  
      Returns:
        The encoded image.
      """
      with tf.variable_scope("van_enc", reuse=reuse):
          a = 4  # depends on the inputs size
          b = 4
          # a, b = 4,4
          enc = tf.nn.relu(x)
          enc = tf.layers.dense(enc, first_depth * a * b, tf.nn.relu)
          enc = contrib.layers().layer_norm(enc)
  
          enc = tf.reshape(enc, [-1, a, b, first_depth])
  
          enc = tf.layers.conv2d_transpose(
              enc,
              first_depth,
              3,
              padding="same",
              activation=tf.nn.relu,
              strides=1,
          )
          enc = contrib.layers().layer_norm(enc)
          enc = tf.layers.conv2d_transpose(
              enc,
              first_depth * 2,
              3,
              padding="same",
              activation=tf.nn.relu,
              strides=2,
          )
          van_higher_level_2 = tf.reshape(
              enc, [-1, a * 2 * b * 2 * first_depth * 2]
          )
  
          enc = tf.layers.conv2d_transpose(
              enc,
              first_depth * 2,
              3,
              padding="same",
              activation=tf.nn.relu,
              strides=1,
          )
          enc = contrib.layers().layer_norm(enc)
          enc = tf.layers.conv2d_transpose(
              enc,
              first_depth * 4,
              3,
              padding="same",
              activation=tf.nn.relu,
              strides=1,
          )
          van_higher_level_4 = tf.reshape(
              enc, [-1, a * 2 * b * 2 * first_depth * 4]
          )
  
          van_higher_level = tf.concat(
              [x, van_higher_level_2, van_higher_level_4], 1
          )
  
          return enc, van_higher_level
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from six.moves import reduce
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.models.video import epva_params
  from tensor2tensor.models.video import sv2p
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  from tensorflow.contrib.framework.python.ops import arg_scope
  from tensorflow.contrib.slim.python.slim.nets import vgg
label_desc: Use image node_id 2 for calling a global function with example usage: van_enc_2d(x, first_depth, reuse) and returns: enc,  van_higher_level