code: def node_aggregate(nodes, h, embedding, W):
      x_idx = []
      h_nei = []
      hidden_size = embedding.embedding_dim
      padding = create_var(torch.zeros(hidden_size), False)
  
      for node_x in nodes:
          x_idx.append(node_x.wid)
          nei = [
              h[(node_y.idx, node_x.idx)] for node_y in node_x.neighbors
          ]
          pad_len = MAX_NB - len(nei)
          nei.extend([padding] * pad_len)
          h_nei.extend(nei)
  
      h_nei = torch.cat(h_nei, dim=0).view(-1, MAX_NB, hidden_size)
      sum_h_nei = h_nei.sum(dim=1)
      x_vec = create_var(torch.LongTensor(x_idx))
      x_vec = embedding(x_vec)
      node_vec = torch.cat([x_vec, sum_h_nei], dim=1)
      return nn.ReLU()(W(node_vec))
  
file_path: DIG/dig/ggraph/method/JTVAE/fast_jtnn/jtnn_enc_bo.py
imports: import torch
  import torch.nn
  from collections import deque
  from .nnutils import create_var, GRU
label_desc: Use image node_id 2 for calling a global function with example usage: node_aggregate(nodes, h, embedding, W) and returns: nn