code: def get_subset_dot_kernel(
      dtype_out, dtype_subset, dtype_a=None, dtype_b=None
  ):
      if dtype_out is None:
          dtype_out = dtype_a
  
      if dtype_b is None:
          if dtype_a is None:
              dtype_b = dtype_out
          else:
              dtype_b = dtype_a
  
      if dtype_a is None:
          dtype_a = dtype_out
  
      # important: lookup_tbl must be first--it controls the length
      return ReductionKernel(
          dtype_out,
          neutral="0",
          reduce_expr="a+b",
          map_expr="a[lookup_tbl[i]]*b[lookup_tbl[i]]",
          arguments="const %(tp_lut)s *lookup_tbl, "
          "const %(tp_a)s *a, const %(tp_b)s *b"
          % {
              "tp_a": dtype_to_ctype(dtype_a),
              "tp_b": dtype_to_ctype(dtype_b),
              "tp_lut": dtype_to_ctype(dtype_subset),
          },
      )
  
file_path: pycuda/pycuda/reduction.py
imports: from pycuda.tools import context_dependent_memoize
  from pycuda.tools import dtype_to_ctype
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: get_subset_dot_kernel(dtype_out, dtype_subset, dtype_a, dtype_b) and returns: ReductionKernel