code: def group_by_relation_type(edges: EdgeList) -> List[EdgeList]:
      """Split the edge list in groups that have the same relation type."""
      if len(edges) == 0:
          return []
      if edges.has_scalar_relation_type():
          return [edges]
  
      # FIXME Is PyTorch's sort stable? Won't this risk messing up the random shuffle?
      sorted_rel, order = edges.rel.sort()
      delta = sorted_rel[1:] - sorted_rel[:-1]
      cutpoints = (delta.nonzero().flatten() + 1).tolist()
  
      result: List[EdgeList] = []
      for start, end in zip([0] + cutpoints, cutpoints + [len(edges)]):
          rel_type = sorted_rel[start]
          edges_for_rel_type = edges[order[start:end]]
          result.append(
              EdgeList(
                  edges_for_rel_type.lhs,
                  edges_for_rel_type.rhs,
                  rel_type,
                  edges_for_rel_type.weight,
              )
          )
      return result
  
file_path: PyTorch-BigGraph/torchbiggraph/batching.py
imports: import time
  from abc import ABC, abstractmethod
  from typing import Any, Callable, Dict, Iterable, List, Optional
  import torch
  from torchbiggraph.edgelist import EdgeList
  from torchbiggraph.losses import AbstractLossFunction
  from torchbiggraph.model import MultiRelationEmbedder, override_model, Scores
  from torchbiggraph.stats import Stats
  from torchbiggraph.types import LongTensorType
label_desc: Use image node_id 1 for calling a global function with example usage: group_by_relation_type(edges) and returns: result, list, list