docstr: tests if the kwargs to the unary functions work
docstr_tok: ["tests","if","the","kwargs","to","the","unary","functions","work"]
code: def test_unary_func_kwargs(self):
      """tests if the kwargs to the unary functions work"""
      from pycuda.driver import Stream
  
      name, a, b, threshold = ("exp", -3, 3, 1e-5)
      gpu_func = getattr(cumath, name)
      cpu_func = getattr(np, numpy_func_names.get(name, name))
      for s in sizes:
          for dtype in dtypes:
              np.random.seed(1)
              A = (np.random.random(s) * (b - a) + a).astype(dtype)
              if complex:
                  A = A + (np.random.random(s) * (b - a) + a) * 1j
  
              np.random.seed(1)
              A = (np.random.random(s) * (b - a) + a).astype(dtype)
              args = gpuarray.to_gpu(A)
  
              # 'out' kw
              gpu_results = gpuarray.empty_like(args)
              gpu_results = gpu_func(args, out=gpu_results).get()
              cpu_results = cpu_func(A)
              max_err = np.max(np.abs(cpu_results - gpu_results))
              assert (max_err <= threshold).all(), (
                  max_err,
                  name,
                  dtype,
              )
  
              # 'out' position
              gpu_results = gpuarray.empty_like(args)
              gpu_results = gpu_func(args, gpu_results).get()
              cpu_results = cpu_func(A)
              max_err = np.max(np.abs(cpu_results - gpu_results))
              assert (max_err <= threshold).all(), (
                  max_err,
                  name,
                  dtype,
              )
  
              # 'stream' kw
              mystream = Stream()
              np.random.seed(1)
              A = (np.random.random(s) * (b - a) + a).astype(dtype)
              args = gpuarray.to_gpu(A)
              gpu_results = gpuarray.empty_like(args)
              gpu_results = gpu_func(args, stream=mystream).get()
              cpu_results = cpu_func(A)
              max_err = np.max(np.abs(cpu_results - gpu_results))
              assert (max_err <= threshold).all(), (
                  max_err,
                  name,
                  dtype,
              )
  
              # 'stream' position
              mystream = Stream()
              np.random.seed(1)
              A = (np.random.random(s) * (b - a) + a).astype(dtype)
              args = gpuarray.to_gpu(A)
              gpu_results = gpuarray.empty_like(args)
              gpu_results = gpu_func(args, mystream).get()
              cpu_results = cpu_func(A)
              max_err = np.max(np.abs(cpu_results - gpu_results))
              assert (max_err <= threshold).all(), (
                  max_err,
                  name,
                  dtype,
              )
  
              # 'out' and 'stream' kw
              mystream = Stream()
              np.random.seed(1)
              A = (np.random.random(s) * (b - a) + a).astype(dtype)
              args = gpuarray.to_gpu(A)
              gpu_results = gpuarray.empty_like(args)
              gpu_results = gpu_func(
                  args, stream=mystream, out=gpu_results
              ).get()
              cpu_results = cpu_func(A)
              max_err = np.max(np.abs(cpu_results - gpu_results))
              assert (max_err <= threshold).all(), (
                  max_err,
                  name,
                  dtype,
              )
  
file_path: pycuda/test/test_cumath.py
imports: import math
  import numpy
  from pycuda.tools import mark_cuda_test
  import pycuda.gpuarray
  import pycuda.driver
  import pycuda.cumath
label_desc: Use image node_id 5 for calling the TestMath obj's underlying member method code with example usage: obj.test_unary_func_kwargs() without return types