code: def _build_graph(self):
      self.x = tf.placeholder(
          tf.float32, [None, self.input_dim], name="text_input"
      )
      self.ratings = tf.placeholder(
          dtype=tf.float32,
          shape=[self.n_users, None],
          name="rating_input",
      )
      self.C = tf.placeholder(
          dtype=tf.float32, shape=[self.n_users, None], name="C_input"
      )
      self.item_ids = tf.placeholder(dtype=tf.int32, name="item_input")
  
      x_recon = self._vae(self.x)
  
      with tf.variable_scope("cf_variable"):
          self.U = tf.get_variable(
              name="U", dtype=tf.float32, initializer=self.U_init
          )
          self.V = tf.get_variable(
              name="V", dtype=tf.float32, initializer=self.V_init
          )
  
      real_batch_size = tf.cast(tf.shape(self.item_ids)[0], tf.int32)
      V_batch = tf.reshape(
          tf.gather(self.V, self.item_ids),
          shape=[real_batch_size, self.n_z],
      )
  
      predictions = tf.matmul(self.U, V_batch, transpose_b=True)
      squared_error = tf.square(self.ratings - predictions)
  
      # CF loss
      rating_loss = tf.reduce_mean(
          tf.reduce_sum(tf.multiply(self.C, squared_error), 0)
      )
      v_loss = (
          self.lambda_v
          / self.lambda_r
          * tf.reduce_mean(
              tf.reduce_sum(tf.square(V_batch - self.z), 1)
          )
      )
      self.cf_loss = (
          rating_loss + v_loss + self.lambda_u * tf.nn.l2_loss(self.U)
      )
  
      # VAE loss
      if self.loss_type == "rmse":
          gen_loss = tf.reduce_mean(
              tf.square(tf.subtract(self.x, x_recon))
          )
      elif self.loss_type == "cross-entropy":
          x_recon = tf.nn.sigmoid(x_recon, name="x_recon")
          gen_loss = -tf.reduce_mean(
              tf.reduce_sum(
                  self.x * tf.log(tf.maximum(x_recon, 1e-10))
                  + (1 - self.x)
                  * tf.log(tf.maximum(1 - x_recon, 1e-10)),
                  1,
              )
          )
      else:
          raise ValueError(
              "Invalid loss type {}".format(self.loss_type)
          )
  
      latent_loss = 0.5 * tf.reduce_mean(
          tf.reduce_sum(
              tf.square(self.z_mean)
              + tf.exp(self.z_log_sigma_sq)
              - self.z_log_sigma_sq
              - 1,
              1,
          )
      )
      self.vae_loss = (
          gen_loss + latent_loss + self.lambda_w * self.reg_loss
      )
  
      cf_op = tf.train.AdamOptimizer(self.lr, name="cf_op")
      vae_op = tf.train.AdamOptimizer(self.lr, name="vae_op")
  
      cf_var_list, vae_var_list = [], []
  
      for var in tf.trainable_variables():
          if "cf_variable" in var.name:
              cf_var_list.append(var)
          elif "vae" in var.name:
              vae_var_list.append(var)
  
      gvs = cf_op.compute_gradients(self.cf_loss, var_list=cf_var_list)
      capped_gvs = [
          (tf.clip_by_value(grad, -5.0, 5.0), var) for grad, var in gvs
      ]
      self.cf_update = cf_op.apply_gradients(capped_gvs)
  
      gvs = vae_op.compute_gradients(
          self.vae_loss, var_list=vae_var_list
      )
      capped_gvs = [
          (tf.clip_by_value(grad, -5.0, 5.0), var) for grad, var in gvs
      ]
      self.vae_update = vae_op.apply_gradients(capped_gvs)
  
imports: import tensorflow.compat.v1
  from ..cdl.cdl import act_functions
label_desc: Use image node_id 2 for calling the Model obj's underlying member method code with example usage: obj._build_graph() without return types