code: def _coalesce_edge_frame(g, edge_maps, counts, aggregator):
      r"""Coalesce edge features of duplicate edges via given aggregator in g.
  
      Parameters
      ----------
      g : DGLGraph
          The input graph.
      edge_maps : List[Tensor]
          The edge mapping corresponding to each edge type in g.
      counts : List[Tensor]
          The number of duplicated edges from the original graph for each edge type.
      aggregator : str
          Indicates how to coalesce edge features, could be ``arbitrary``, ``sum``
          or ``mean``.
  
      Returns
      -------
      List[Frame]
          The frames corresponding to each edge type.
      """
      if aggregator == "arbitrary":
          eids = []
          for i in range(len(g.canonical_etypes)):
              feat_idx = F.asnumpy(edge_maps[i])
              _, indices = np.unique(feat_idx, return_index=True)
              eids.append(F.zerocopy_from_numpy(indices))
  
          edge_frames = utils.extract_edge_subframes(g, eids)
      elif aggregator in ["sum", "mean"]:
          edge_frames = []
          for i in range(len(g.canonical_etypes)):
              feat_idx = edge_maps[i]
              _, indices = np.unique(
                  F.asnumpy(feat_idx), return_index=True
              )
              _num_rows = len(indices)
              _data = {}
              for key, col in g._edge_frames[i]._columns.items():
                  data = col.data
                  new_data = F.scatter_add(data, feat_idx, _num_rows)
                  if aggregator == "mean":
                      norm = F.astype(counts[i], F.dtype(data))
                      norm = F.reshape(
                          norm,
                          (F.shape(norm)[0],)
                          + (1,) * (F.ndim(data) - 1),
                      )
                      new_data /= norm
                  _data[key] = new_data
  
              newf = Frame(data=_data, num_rows=_num_rows)
              edge_frames.append(newf)
      else:
          raise DGLError(
              "Aggregator {} not regonized, cannot coalesce edge feature in the "
              "specified way".format(aggregator)
          )
      return edge_frames
  
imports: import copy
  from collections.abc import Iterable, Mapping
  import numpy
  import scipy.sparse
  import scipy.sparse.linalg
  from ..utils import version
  from ..None import backend, batch, convert, function, ndarray, subgraph, utils
  from .._ffi.function import _init_api
  from ..base import dgl_warning, DGLError, EID, NID
  from ..frame import Frame
  from ..heterograph import DGLGraph
  from ..heterograph_index import create_heterograph_from_relations, create_metagraph_index
  from ..partition import metis_partition, metis_partition_assignment, partition_graph_with_halo
  from ..sampling.neighbor import sample_neighbors
label_desc: Use image node_id 24 for calling a global function with example usage: _coalesce_edge_frame(g, edge_maps, counts, aggregator) and returns: edge_frames