code: def main(args, seed):
      # Configure
      np.random.seed(seed)
      torch.manual_seed(seed)
  
      if not args.no_cuda and torch.cuda.is_available():
          print("[ Using CUDA ]")
          device = torch.device(
              "cuda" if args.gpu < 0 else "cuda:%d" % args.gpu
          )
          cudnn.benchmark = True
          torch.cuda.manual_seed(seed)
      else:
          device = torch.device("cpu")
  
      raw_text_data = [
          ["I like nlp.", "Same here!"],
          ["I like graph.", "Same here!"],
      ]
  
      vocab_model = VocabModel(
          raw_text_data,
          max_word_vocab_size=None,
          min_word_vocab_freq=1,
          word_emb_size=300,
      )
  
      src_text_seq = list(zip(*raw_text_data))[0]
  
      # Test raw_text_to_init_graph method of dynamic graph construction class
      text_graphs = []
      for each in src_text_seq:
          tmp_graph = NodeEmbeddingBasedGraphConstruction.raw_text_to_init_graph(
              each
          )
          text_graphs.append(tmp_graph)
  
      src_idx_seq = [
          vocab_model.word_vocab.to_index_sequence(each)
          for each in src_text_seq
      ]
      src_len = torch.LongTensor(
          [len(each) for each in src_idx_seq]
      ).to(device)
      num_seq = torch.LongTensor([len(src_len)]).to(device)
      input_tensor = torch.LongTensor(
          pad_2d_vals_no_size(src_idx_seq)
      ).to(device)
      print("input_tensor: {}".format(input_tensor.shape))
  
      embedding_styles = {
          "word_emb_type": "w2v",
          "node_edge_emb_strategy": "bilstm",
          "seq_info_encode_strategy": "none",
      }
  
      gl = NodeEmbeddingBasedGraphConstruction(
          vocab_model.word_vocab,
          embedding_styles,
          input_size=args.gl_num_hidden,
          hidden_size=args.gl_num_hidden,
          top_k_neigh=args.gl_topk,
          device=device,
      )
  
      gl.to(device)
      print(gl)
  
      graph = gl(input_tensor, src_len, num_seq)
      print("\nadj:", graph.adjacency_matrix().to_dense())
      print("node feat: ", graph.ndata["node_feat"])
  
file_path: graph4nlp/graph4nlp/pytorch/test/graph_construction/run_dynamic_text_graph_construction.py
imports: import argparse
  import numpy
  import torch
  import torch.backends.cudnn
  from dgl.data import register_data_args
  from ...modules.graph_construction import NodeEmbeddingBasedGraphConstruction
  from ...modules.utils.padding_utils import pad_2d_vals_no_size
  from ...modules.utils.vocab_utils import VocabModel
label_desc: Use image node_id 1 for calling a global function with example usage: main(args, seed) without return types