code: def test_fetch_float4_texture(self):
      width = 47
      height = 39
      depth = 11
      n_channel = 4
  
      # generate input data and allocate output buffer
      in_shape = (depth, height, n_channel * width)
      out_shape = (depth, height, width)
  
      # prepare input, output, and texture memory
      tex_data = cupy.random.random(in_shape, dtype=cupy.float32)
      real_output_x = cupy.zeros(out_shape, dtype=cupy.float32)
      real_output_y = cupy.zeros(out_shape, dtype=cupy.float32)
      real_output_z = cupy.zeros(out_shape, dtype=cupy.float32)
      real_output_w = cupy.zeros(out_shape, dtype=cupy.float32)
      ch = ChannelFormatDescriptor(
          32, 32, 32, 32, runtime.cudaChannelFormatKindFloat
      )
      arr = CUDAarray(ch, width, height, depth)
      arr.copy_from(tex_data)
  
      # create resource and texture descriptors
      res = ResourceDescriptor(runtime.cudaResourceTypeArray, cuArr=arr)
      address_mode = (
          runtime.cudaAddressModeClamp,
          runtime.cudaAddressModeClamp,
      )
      tex = TextureDescriptor(
          address_mode,
          runtime.cudaFilterModePoint,
          runtime.cudaReadModeElementType,
      )
  
      if self.target == "object":
          # create a texture object
          texobj = TextureObject(res, tex)
          mod = cupy.RawModule(code=source_texobj)
      else:
          assert False
  
      # get and launch the kernel
      ker_name = "copyKernel3D_4ch"
      ker = mod.get_function(ker_name)
      block = (4, 4, 2)
      grid = (
          (width + block[0] - 1) // block[0],
          (height + block[1] - 1) // block[1],
          (depth + block[2] - 1) // block[2],
      )
      args = (
          real_output_x,
          real_output_y,
          real_output_z,
          real_output_w,
      )
      if self.target == "object":
          args = args + (texobj,)
      args = args + (width, height, depth)
      ker(grid, block, args)
  
      # validate result
      assert (real_output_x == tex_data[..., 0::4]).all()
      assert (real_output_y == tex_data[..., 1::4]).all()
      assert (real_output_z == tex_data[..., 2::4]).all()
      assert (real_output_w == tex_data[..., 3::4]).all()
  
file_path: cupy/tests/cupy_tests/cuda_tests/test_texture.py
imports: import numpy
  import pytest
  import cupy
  from cupy import testing
  from cupy.cuda import runtime
  from cupy.cuda.texture import ChannelFormatDescriptor, CUDAarray, ResourceDescriptor, TextureDescriptor, TextureObject, SurfaceObject
label_desc: Use image node_id 1 for calling the TestTextureVectorType obj's underlying member method code with example usage: obj.test_fetch_float4_texture() without return types