code: def GRU(x, h_nei, W_z, W_r, U_r, W_h):
      hidden_size = x.size()[-1]
      sum_h = h_nei.sum(dim=1)
      z_input = torch.cat([x, sum_h], dim=1)
      z = F.sigmoid(W_z(z_input))
  
      r_1 = W_r(x).view(-1, 1, hidden_size)
      r_2 = U_r(h_nei)
      r = F.sigmoid(r_1 + r_2)
  
      gated_h = r * h_nei
      sum_gated_h = gated_h.sum(dim=1)
      h_input = torch.cat([x, sum_gated_h], dim=1)
      pre_h = F.tanh(W_h(h_input))
      new_h = (1.0 - z) * sum_h + z * pre_h
      return new_h
  
file_path: DIG/dig/ggraph/method/JTVAE/fast_jtnn/nnutils.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.autograd import Variable
label_desc: Use image node_id 7 for calling a global function with example usage: GRU(x, h_nei, W_z, W_r, U_r, W_h) and returns: new_h