code: def _cosine(x, y):
      p = x.ravel()
      q = y.ravel()
      p_norm = np.linalg.norm(p)
      q_norm = np.linalg.norm(q)
      if p_norm * q_norm:
          return (p.T @ q) / (p_norm * q_norm)
      elif p_norm == q_norm:
          return 1
      else:
          return 0
  
imports: from functools import partial
  import numpy
  from scipy.spatial.distance import cdist
  from ...utils import _check_option, _validate_type, fill_doc
label_desc: Use image node_id 6 for calling a global function with example usage: _cosine(x, y) and returns: unknown, int, int