code: def _vae(self, X):
      act_fn = act_functions.get(self.act_fn, None)
      if act_fn is None:
          raise ValueError(
              "Invalid type of activation function {}\n"
              "Supported functions: {}".format(
                  act_fn, act_functions.keys()
              )
          )
  
      with tf.variable_scope("vae/inference"):
          rec = {
              "W1": tf.get_variable(
                  "W1",
                  [self.input_dim, self.layers[0]],
                  initializer=tf.keras.initializers.glorot_uniform(
                      seed=self.seed
                  ),
                  dtype=tf.float32,
              ),
              "b1": tf.get_variable(
                  "b1",
                  [self.layers[0]],
                  initializer=tf.constant_initializer(0.0),
                  dtype=tf.float32,
              ),
              "W2": tf.get_variable(
                  "W2",
                  [self.layers[0], self.layers[1]],
                  initializer=tf.keras.initializers.glorot_uniform(
                      seed=self.seed
                  ),
                  dtype=tf.float32,
              ),
              "b2": tf.get_variable(
                  "b2",
                  [self.layers[1]],
                  initializer=tf.constant_initializer(0.0),
                  dtype=tf.float32,
              ),
              "W_z_mean": tf.get_variable(
                  "W_z_mean",
                  [self.layers[1], self.n_z],
                  initializer=tf.keras.initializers.glorot_uniform(
                      seed=self.seed
                  ),
                  dtype=tf.float32,
              ),
              "b_z_mean": tf.get_variable(
                  "b_z_mean",
                  [self.n_z],
                  initializer=tf.constant_initializer(0.0),
                  dtype=tf.float32,
              ),
              "W_z_log_sigma": tf.get_variable(
                  "W_z_log_sigma",
                  [self.layers[1], self.n_z],
                  initializer=tf.keras.initializers.glorot_uniform(
                      seed=self.seed
                  ),
                  dtype=tf.float32,
              ),
              "b_z_log_sigma": tf.get_variable(
                  "b_z_log_sigma",
                  [self.n_z],
                  initializer=tf.constant_initializer(0.0),
                  dtype=tf.float32,
              ),
          }
  
      h1 = act_fn(tf.matmul(X, rec["W1"]) + rec["b1"])
      h2 = act_fn(tf.matmul(h1, rec["W2"]) + rec["b2"])
  
      self.z_mean = tf.matmul(h2, rec["W_z_mean"]) + rec["b_z_mean"]
      self.z_log_sigma_sq = (
          tf.matmul(h2, rec["W_z_log_sigma"]) + rec["b_z_log_sigma"]
      )
  
      eps = tf.random_normal(
          shape=tf.shape(self.z_mean),
          mean=0,
          stddev=1,
          seed=self.seed,
          dtype=tf.float32,
      )
  
      self.z = (
          self.z_mean
          + tf.sqrt(tf.maximum(tf.exp(self.z_log_sigma_sq), 1e-10))
          * eps
      )
  
      with tf.variable_scope("vae/generation"):
          gen = {
              "W2": tf.get_variable(
                  "W2",
                  [self.n_z, self.layers[1]],
                  initializer=tf.keras.initializers.glorot_uniform(
                      seed=self.seed
                  ),
                  dtype=tf.float32,
              ),
              "b2": tf.get_variable(
                  "b2",
                  [self.layers[1]],
                  initializer=tf.constant_initializer(0.0),
                  dtype=tf.float32,
              ),
              "W1": tf.transpose(rec["W2"]),
              "b1": rec["b1"],
              "W_x": tf.transpose(rec["W1"]),
              "b_x": tf.get_variable(
                  "b_x",
                  [self.input_dim],
                  initializer=tf.constant_initializer(0.0),
                  dtype=tf.float32,
              ),
          }
  
      self.reg_loss = (
          tf.nn.l2_loss(rec["W1"])
          + tf.nn.l2_loss(rec["W2"])
          + tf.nn.l2_loss(gen["W1"])
          + tf.nn.l2_loss(gen["W_x"])
      )
  
      h2 = act_fn(tf.matmul(self.z, gen["W2"]) + gen["b2"])
      h1 = act_fn(tf.matmul(h2, gen["W1"]) + gen["b1"])
      x_recon = tf.matmul(h1, gen["W_x"]) + gen["b_x"]
  
      return x_recon
  
imports: import tensorflow.compat.v1
  from ..cdl.cdl import act_functions
label_desc: Use image node_id 3 for calling the Model obj's underlying member method code with example usage: obj._vae(X) and returns: x_recon