class_docstr: Interface for message passing layer to be used in graph neural networks with multiple edge types.
class_docstr_tok: ["Interface","for","message","passing","layer","to","be","used","in","graph","neural","networks","with","multiple","edge","types","."]
docstr: Utility function to be used by concrete implementors.
docstr_tok: ["Utility","function","to","be","used","by","concrete","implementors","."]
code: def _aggregate_messages(
      self,
      messages: torch.Tensor,
      message_targets: torch.Tensor,
      num_nodes,
      aggregation_fn: str,
  ):
      """Utility function to be used by concrete implementors."""
      # Support AMP
      msg_dtype = messages.dtype
      return scatter(
          messages.to(torch.float32),
          index=message_targets,
          dim=0,
          dim_size=num_nodes,
          reduce=aggregation_fn,
      ).to(msg_dtype)
  
file_path: ptgnn/ptgnn/neuralmodels/gnn/messagepassing/abstractmessagepassing.py
imports: import torch
  from abc import abstractmethod
  from torch import nn
  from torch_scatter import scatter
  from typing import Dict, List, Tuple
label_desc: Use image node_id 2 for calling the AbstractMessagePassingLayer obj's underlying member method code with example usage: obj._aggregate_messages(messages, message_targets, num_nodes, aggregation_fn) and returns: scatter