code: def train(self):
      adj_mat = self.adj_mat
  
      AdjBatch = tf.placeholder(
          tf.float32, [None, self.node_size], name="adj_batch"
      )
      Adj = tf.placeholder(tf.float32, [None, None], name="adj_mat")
      B = tf.placeholder(
          tf.float32, [None, self.node_size], name="b_mat"
      )
  
      fc = AdjBatch
      scope_name = "encoder"
      layer_collector = []
  
      with tf.name_scope(scope_name):
          for i in range(1, self.encoder_layer_num):
              fc = fc_op(
                  fc,
                  name=scope_name + str(i),
                  n_out=self.encoder_layer_list[i],
                  layer_collector=layer_collector,
              )
  
      _embeddings = fc
  
      scope_name = "decoder"
      with tf.name_scope(scope_name):
          for i in range(self.encoder_layer_num - 2, 0, -1):
              fc = fc_op(
                  fc,
                  name=scope_name + str(i),
                  n_out=self.encoder_layer_list[i],
                  layer_collector=layer_collector,
              )
          fc = fc_op(
              fc,
              name=scope_name + str(0),
              n_out=self.encoder_layer_list[0],
              layer_collector=layer_collector,
          )
  
      _embeddings_norm = tf.reduce_sum(
          tf.square(_embeddings), 1, keepdims=True
      )
  
      L_1st = tf.reduce_sum(
          Adj
          * (
              _embeddings_norm
              - 2 * tf.matmul(_embeddings, tf.transpose(_embeddings))
              + tf.transpose(_embeddings_norm)
          )
      )
  
      L_2nd = tf.reduce_sum(tf.square((AdjBatch - fc) * B))
  
      L = L_2nd + self.alpha * L_1st
  
      for param in layer_collector:
          L += self.nu1 * tf.reduce_sum(
              tf.abs(param[0])
          ) + self.nu2 * tf.reduce_sum(tf.square(param[0]))
  
      optimizer = tf.train.AdamOptimizer(self.lr)
  
      train_op = optimizer.minimize(L)
  
      init = tf.global_variables_initializer()
      self.sess.run(init)
  
      print("total iter: %i" % self.max_iter)
      for step in range(self.max_iter):
          index = np.random.randint(self.node_size, size=self.bs)
          adj_batch_train = adj_mat[index, :]
          adj_mat_train = adj_batch_train[:, index]
          b_mat_train = np.ones_like(adj_batch_train)
          b_mat_train[adj_batch_train != 0] = self.beta
  
          self.sess.run(
              train_op,
              feed_dict={
                  AdjBatch: adj_batch_train,
                  Adj: adj_mat_train,
                  B: b_mat_train,
              },
          )
          if step % 50 == 0:
              l, l1, l2 = self.sess.run(
                  (L, L_1st, L_2nd),
                  feed_dict={
                      AdjBatch: adj_batch_train,
                      Adj: adj_mat_train,
                      B: b_mat_train,
                  },
              )
              print(
                  "step %i: total loss: %s, l1 loss: %s, l2 loss: %s"
                  % (step, l, l1, l2)
              )
  
      return self.sess.run(_embeddings, feed_dict={AdjBatch: adj_mat})
  
file_path: OpenNE/src/openne/sdne.py
imports: import tensorflow
  import numpy
label_desc: Use image node_id 3 for calling the SDNE obj's underlying member method code with example usage: obj.train() and returns: self