parameters: (res, xq, xb, D=None, metric=METRIC_L2)
return_statement: return D
docstring: Compute all pairwise distances between xq and xb on one GPU without constructing an index
  
      Parameters
      ----------
      res : StandardGpuResources
          GPU resources to use during computation
      xq : array_like
          Query vectors, shape (nq, d) where d is appropriate for the index.
          `dtype` must be float32.
      xb : array_like
          Database vectors, shape (nb, d) where d is appropriate for the index.
          `dtype` must be float32.
      D : array_like, optional
          Output array for all pairwise distances, shape (nq, nb)
      distance_type : MetricType, optional
          distance measure to use (either METRIC_L2 or METRIC_INNER_PRODUCT)
  
      Returns
      -------
      D : array_like
          All pairwise distances, shape (nq, nb)
docstring_summary: Compute all pairwise distances between xq and xb on one GPU without constructing an index
docstring_tokens: Compute all pairwise distances between xq and xb on one GPU without constructing an index
function: def pairwise_distance_gpu(res, xq, xb, D=None, metric=METRIC_L2):
      """
      Compute all pairwise distances between xq and xb on one GPU without constructing an index
  
      Parameters
      ----------
      res : StandardGpuResources
          GPU resources to use during computation
      xq : array_like
          Query vectors, shape (nq, d) where d is appropriate for the index.
          `dtype` must be float32.
      xb : array_like
          Database vectors, shape (nb, d) where d is appropriate for the index.
          `dtype` must be float32.
      D : array_like, optional
          Output array for all pairwise distances, shape (nq, nb)
      distance_type : MetricType, optional
          distance measure to use (either METRIC_L2 or METRIC_INNER_PRODUCT)
  
      Returns
      -------
      D : array_like
          All pairwise distances, shape (nq, nb)
      """
      nq, d = xq.shape
      if xq.flags.c_contiguous:
          xq_row_major = True
      elif xq.flags.f_contiguous:
          xq = xq.T
          xq_row_major = False
      else:
          raise TypeError('xq matrix should be row (C) or column-major (Fortran)')
  
      xq_ptr = swig_ptr(xq)
  
      if xq.dtype == np.float32:
          xq_type = DistanceDataType_F32
      elif xq.dtype == np.float16:
          xq_type = DistanceDataType_F16
      else:
          raise TypeError('xq must be float32 or float16')
  
      nb, d2 = xb.shape
      assert d2 == d
      if xb.flags.c_contiguous:
          xb_row_major = True
      elif xb.flags.f_contiguous:
          xb = xb.T
          xb_row_major = False
      else:
          raise TypeError('xb matrix should be row (C) or column-major (Fortran)')
  
      xb_ptr = swig_ptr(xb)
  
      if xb.dtype == np.float32:
          xb_type = DistanceDataType_F32
      elif xb.dtype == np.float16:
          xb_type = DistanceDataType_F16
      else:
          raise TypeError('xb must be float32 or float16')
  
      if D is None:
          D = np.empty((nq, nb), dtype=np.float32)
      else:
          assert D.shape == (nq, nb)
          # interface takes void*, we need to check this
          assert D.dtype == np.float32
  
      D_ptr = swig_ptr(D)
  
      args = GpuDistanceParams()
      args.metric = metric
      args.k = -1 # selects all pairwise distances
      args.dims = d
      args.vectors = xb_ptr
      args.vectorsRowMajor = xb_row_major
      args.vectorType = xb_type
      args.numVectors = nb
      args.queries = xq_ptr
      args.queriesRowMajor = xq_row_major
      args.queryType = xq_type
      args.numQueries = nq
      args.outDistances = D_ptr
  
      # no stream synchronization needed, inputs and outputs are guaranteed to
      # be on the CPU (numpy arrays)
      bfKnn(res, args)
  
      return D
function_tokens: def pairwise_distance_gpu ( res , xq , xb , D = None , metric = METRIC_L2 ) : nq , d = xq . shape if xq . flags . c_contiguous : xq_row_major = True elif xq . flags . f_contiguous : xq = xq . T xq_row_major = False else : raise TypeError ( 'xq matrix should be row (C) or column-major (Fortran)' ) xq_ptr = swig_ptr ( xq ) if xq . dtype == np . float32 : xq_type = DistanceDataType_F32 elif xq . dtype == np . float16 : xq_type = DistanceDataType_F16 else : raise TypeError ( 'xq must be float32 or float16' ) nb , d2 = xb . shape assert d2 == d if xb . flags . c_contiguous : xb_row_major = True elif xb . flags . f_contiguous : xb = xb . T xb_row_major = False else : raise TypeError ( 'xb matrix should be row (C) or column-major (Fortran)' ) xb_ptr = swig_ptr ( xb ) if xb . dtype == np . float32 : xb_type = DistanceDataType_F32 elif xb . dtype == np . float16 : xb_type = DistanceDataType_F16 else : raise TypeError ( 'xb must be float32 or float16' ) if D is None : D = np . empty ( ( nq , nb ) , dtype = np . float32 ) else : assert D . shape == ( nq , nb ) # interface takes void*, we need to check this assert D . dtype == np . float32 D_ptr = swig_ptr ( D ) args = GpuDistanceParams ( ) args . metric = metric args . k = - 1 # selects all pairwise distances args . dims = d args . vectors = xb_ptr args . vectorsRowMajor = xb_row_major args . vectorType = xb_type args . numVectors = nb args . queries = xq_ptr args . queriesRowMajor = xq_row_major args . queryType = xq_type args . numQueries = nq args . outDistances = D_ptr # no stream synchronization needed, inputs and outputs are guaranteed to # be on the CPU (numpy arrays) bfKnn ( res , args ) return D