code: def _nn_cosine_distance(s, q):
      """
      Compute pair-wise cosine distance between points in `s` and `q`.
  
      Args:
          s (ndarray): Sample points: an NxM matrix of N samples of dimensionality M.
          q (ndarray): Query points: an LxM matrix of L samples of dimensionality M.
  
      Returns:
          distances (ndarray): A vector of length M that contains for each entry in `q` the
              smallest Euclidean distance to a sample in `s`.
      """
      s = np.asarray(s) / np.linalg.norm(s, axis=1, keepdims=True)
      q = np.asarray(q) / np.linalg.norm(q, axis=1, keepdims=True)
      distances = 1.0 - np.dot(s, q.T)
  
      return distances.min(axis=0)
  
file_path: PaddleHub/modules/video/multiple_object_tracking/jde_darknet53/modeling/mot/matching/deepsort_matching.py
imports: import numpy
  from scipy.optimize import linear_sum_assignment
  from ..motion import kalman_filter
label_desc: Use image node_id 4 for calling a global function with example usage: _nn_cosine_distance(s, q) and returns: distances