code: def generate_batch(self, shuffle=True):
      adj = self.adj_mat
  
      row_indices, col_indices = adj.nonzero()
      sample_index = np.arange(row_indices.shape[0])
      num_of_batches = row_indices.shape[0] // self.bs
      counter = 0
      if shuffle:
          np.random.shuffle(sample_index)
  
      while True:
          batch_index = sample_index[
              self.bs * counter : self.bs * (counter + 1)
          ]
  
          nodes_a = adj[row_indices[batch_index], :]
          nodes_b = adj[col_indices[batch_index], :]
          weights = adj[
              row_indices[batch_index], col_indices[batch_index]
          ]
          weights = np.reshape(weights, [-1, 1])
  
          beta_mask_a = np.ones_like(nodes_a)
          beta_mask_a[nodes_a != 0] = self.beta
          beta_mask_b = np.ones_like(nodes_b)
          beta_mask_b[nodes_b != 0] = self.beta
  
          if counter == num_of_batches:
              counter = 0
              np.random.shuffle(sample_index)
          else:
              counter += 1
  
          yield (nodes_a, nodes_b, beta_mask_a, beta_mask_b, weights)
  
file_path: OpenNE/src/openne/sdne.py
imports: import tensorflow
  import numpy
label_desc: Use image node_id 4 for calling the SDNE2 obj's underlying member method code with example usage: obj.generate_batch(shuffle) without return types