code: def sparse_assign_to_dense(xq, xb, xq_norms=None, xb_norms=None):
      """assignment function for xq is sparse, xb is dense
      uses a matrix multiplication. The squared norms can be provided if available.
      """
      nq = xq.shape[0]
      nb = xb.shape[0]
      if xb_norms is None:
          xb_norms = (xb**2).sum(1)
      if xq_norms is None:
          xq_norms = np.array(xq.power(2).sum(1))
      d2 = xb_norms - 2 * xq @ xb.T
      I = d2.argmin(axis=1)
      D = d2.ravel()[I + np.arange(nq) * nb] + xq_norms.ravel()
      return D, I
  
imports: import numpy
  import faiss
  import time
  from multiprocessing.pool import ThreadPool
label_desc: Use image node_id 4 for calling a global function with example usage: sparse_assign_to_dense(xq, xb, xq_norms, xb_norms) and returns: D,  I