code: def _sum_outer_products(data, a_inds, b_inds, weights=None):
      Xab = data[a_inds] - data[b_inds]
      if weights is not None:
          return np.dot(Xab.T, Xab * weights[:, None])
      return np.dot(Xab.T, Xab)
  
file_path: metric-learn/metric_learn/lmnn.py
imports: import numpy
  from collections import Counter
  from sklearn.metrics import euclidean_distances
  from sklearn.base import TransformerMixin
  import warnings
  from ._util import _initialize_components, _check_n_components
  from .base_metric import MahalanobisMixin
label_desc: Use image node_id 3 for calling a global function with example usage: _sum_outer_products(data, a_inds, b_inds, weights) and returns: np, np