code: def test_astype(ctx_factory):
      context = ctx_factory()
      queue = cl.CommandQueue(context)
  
      from pyopencl.clrandom import rand as clrand
  
      if not has_double_support(context.devices[0]):
          from pytest import skip
  
          skip(
              "double precision not supported on %s"
              % context.devices[0]
          )
  
      a_gpu = clrand(queue, (2000,), dtype=np.float32)
  
      a = a_gpu.get().astype(np.float64)
      a2 = a_gpu.astype(np.float64).get()
  
      assert a2.dtype == np.float64
      assert la.norm(a - a2) == 0, (a, a2)
  
      a_gpu = clrand(queue, (2000,), dtype=np.float64)
  
      a = a_gpu.get().astype(np.float32)
      a2 = a_gpu.astype(np.float32).get()
  
      assert a2.dtype == np.float32
      assert la.norm(a - a2) / la.norm(a) < 1e-7
  
imports: import numpy
  import numpy.linalg
  import sys
  from pytools import memoize
  from test_array import general_clrand
  import pytest
  import pyopencl
  import pyopencl.array
  from pyopencl.tools import pytest_generate_tests_for_pyopencl
  from pyopencl.characterize import has_double_support, has_struct_arg_count_bug
  from pyopencl.scan import InclusiveScanKernel, ExclusiveScanKernel, GenericScanKernel, GenericDebugScanKernel
  from pyopencl.characterize import get_pocl_version
label_desc: Use image node_id 9 for calling a global function with example usage: test_astype(ctx_factory) without return types