code: def get_edge_offset_dict(
      input_dict: Dict[EdgeType, Union[Tensor, SparseTensor]],
      type2id: Dict[EdgeType, int],
  ) -> Dict[EdgeType, int]:
      cumsum = 0
      out: Dict[EdgeType, int] = {}
      for key in type2id.keys():
          out[key] = cumsum
          value = input_dict[key]
          if isinstance(value, SparseTensor):
              cumsum += value.nnz()
          elif value.dtype == torch.long and value.size(0) == 2:
              cumsum += value.size(-1)
          else:
              cumsum += value.size(-2)
      return out
  
imports: import copy
  import warnings
  from typing import Any, Dict, List, Optional, Union
  import torch
  from torch import Tensor
  from torch.nn import Module, Parameter
  from torch_geometric.nn.conv import MessagePassing
  from torch_geometric.nn.dense import Linear
  from torch_geometric.nn.fx import Transformer
  from torch_geometric.typing import EdgeType, Metadata, NodeType, SparseTensor
  from torch_geometric.utils.hetero import get_unused_node_types
label_desc: Use image node_id 3 for calling a global function with example usage: get_edge_offset_dict(input_dict, type2id) and returns: out