class_docstr: A generic wrapper for computing graph convolution on heterogeneous
  graphs.
  This layer will pass messages from source nodes to target nodes based on
  the bipartite GNN layer given for a specific edge type.
  If multiple relations point to the same destination, their results will be
  aggregated according to :attr:`aggr`.
  In comparison to :meth:`torch_geometric.nn.to_hetero`, this layer is
  especially useful if you want to apply different message passing modules
  for different edge types.
  
  .. code-block:: python
  
      hetero_conv = HeteroConv({
          ('paper', 'cites', 'paper'): GCNConv(-1, 64),
          ('author', 'writes', 'paper'): SAGEConv((-1, -1), 64),
          ('paper', 'written_by', 'author'): GATConv((-1, -1), 64),
      }, aggr='sum')
  
      out_dict = hetero_conv(x_dict, edge_index_dict)
  
      print(list(out_dict.keys()))
      >>> ['paper', 'author']
  
  Args:
      convs (Dict[Tuple[str, str, str], MessagePassing]): A dictionary
          holding a bipartite
          :class:`~torch_geometric.nn.conv.MessagePassing` layer for each
          individual edge type.
      aggr (str, optional): The aggregation scheme to use for grouping node
          embeddings generated by different relations
          (:obj:`"sum"`, :obj:`"mean"`, :obj:`"min"`, :obj:`"max"`,
          :obj:`"cat"`, :obj:`None`). (default: :obj:`"sum"`)
class_docstr_tok: ["A","generic","wrapper","for","computing","graph","convolution","on","heterogeneous","graphs",".","This","layer","will","pass","messages","from","source","nodes","to","target","nodes","based","on","the","bipartite","GNN","layer","given","for","a","specific","edge","type",".","If","multiple","relations","point","to","the","same","destination",",","their","results","will","be","aggregated","according","to",":","attr",":","`","aggr","`",".","In","comparison","to",":","meth",":","`","torch_geometric.nn.to_hetero","`",",","this","layer","is","especially","useful","if","you","want","to","apply","different","message","passing","modules","for","different","edge","types",".","..","code-block",":",":","python","hetero_conv","=","HeteroConv","(","{","(","'paper","'",",","'cites","'",",","'paper","'",")",":","GCNConv","(","-1",",","64",")",",","(","'author","'",",","'writes","'",",","'paper","'",")",":","SAGEConv","(","(","-1",",","-1",")",",","64",")",",","(","'paper","'",",","'written_by","'",",","'author","'",")",":","GATConv","(","(","-1",",","-1",")",",","64",")",",","}",",","aggr='sum","'",")","out_dict","=","hetero_conv","(","x_dict",",","edge_index_dict",")","print","(","list","(","out_dict.keys","(",")",")",")",">",">",">","[","'paper","'",",","'author","'","]","Args",":","convs","(","Dict","[","Tuple","[","str",",","str",",","str","]",",","MessagePassing","]",")",":","A","dictionary","holding","a","bipartite",":","class",":","`","~torch_geometric.nn.conv.MessagePassing","`","layer","for","each","individual","edge","type",".","aggr","(","str",",","optional",")",":","The","aggregation","scheme","to","use","for","grouping","node","embeddings","generated","by","different","relations","(",":","obj",":","`","``","sum","''","`",",",":","obj",":","`","``","mean","''","`",",",":","obj",":","`","``","min","''","`",",",":","obj",":","`","``","max","''","`",",",":","obj",":","`","``","cat","''","`",",",":","obj",":","`","None","`",")",".","(","default",":",":","obj",":","`","``","sum","''","`",")"]
code: def __repr__(self) -> str:
      return (
          f"{self.__class__.__name__}(num_relations={len(self.convs)})"
      )
  
file_path: pytorch_geometric/torch_geometric/nn/conv/hetero_conv.py
imports: import warnings
  from typing import Dict, List, Optional
  import torch
  from torch import Tensor
  from torch_geometric.nn.conv import MessagePassing
  from torch_geometric.nn.module_dict import ModuleDict
  from torch_geometric.typing import EdgeType, NodeType
  from torch_geometric.utils.hetero import check_add_self_loops
label_desc: Use image node_id 4 for calling the HeteroConv obj's underlying member method code with example usage: obj.__repr__() and returns: self, str, len, str