code: def __init__(
      self,
      num_nodes,
      embed_size=16,
      neg_num=5,
      sparse=False,
      sparse_embedding=False,
  ):
      super(SkipGramModel, self).__init__()
  
      self.num_nodes = num_nodes
      self.neg_num = neg_num
  
      embed_init = nn.initializer.Uniform(low=-1.0, high=1.0)
      emb_attr = paddle.ParamAttr(
          name="node_embedding", initializer=embed_init
      )
  
      if sparse_embedding:
  
          def emb_func(x):
              d_shape = paddle.shape(x)
              x_emb = paddle.static.nn.sparse_embedding(
                  paddle.reshape(x, [-1, 1]),
                  [num_nodes, embed_size],
                  param_attr=emb_attr,
              )
              return paddle.reshape(
                  x_emb, [d_shape[0], d_shape[1], embed_size]
              )
  
          self.emb = emb_func
      else:
          self.emb = nn.Embedding(
              num_nodes, embed_size, sparse=sparse, weight_attr=emb_attr
          )
      self.loss = paddle.nn.BCEWithLogitsLoss()
  
file_path: PGL/examples/node2vec/model.py
imports: import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 1 to create a new SkipGramModel object from inherited base classes: nn with example: obj = SkipGramModel(num_nodes, embed_size, neg_num, sparse, sparse_embedding)