code: def group(
      xs: List[Tensor],
      q: nn.Parameter,
      k_lin: nn.Module,
  ) -> Tuple[OptTensor, OptTensor]:
      if len(xs) == 0:
          return None, None
      else:
          num_edge_types = len(xs)
          out = torch.stack(xs)
          if out.numel() == 0:
              return out.view(0, out.size(-1)), None
          attn_score = (q * torch.tanh(k_lin(out)).mean(1)).sum(-1)
          attn = F.softmax(attn_score, dim=0)
          out = torch.sum(attn.view(num_edge_types, 1, -1) * out, dim=0)
          return out, attn
  
file_path: pytorch_geometric/torch_geometric/nn/conv/han_conv.py
imports: from typing import Dict, List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from torch import Tensor, nn
  from torch_geometric.nn.conv import MessagePassing
  from torch_geometric.nn.dense import Linear
  from torch_geometric.nn.inits import glorot, reset
  from torch_geometric.typing import PairTensor
  from torch_geometric.typing import Adj, EdgeType, Metadata, NodeType, OptTensor
  from torch_geometric.utils import softmax
label_desc: Use image node_id 1 for calling a global function with example usage: group(xs, q, k_lin) and returns: None,  None, out,  attn, out,  None