code: def gpu_iuwt_decomposition(in1, scale_count, scale_adjust, store_smoothed, store_on_gpu):
      ker = SourceModule(
  )
      wavelet_filter = (1./16)*np.array([1,4,6,4,1], dtype=np.float32)
      wavelet_filter = gpuarray.to_gpu_async(wavelet_filter)
      detail_coeffs = gpuarray.empty([scale_count-scale_adjust, in1.shape[0], in1.shape[1]], np.float32)
      try:
          gpu_in1 = gpuarray.to_gpu_async(in1.astype(np.float32))
      except:
          gpu_in1 = in1
      gpu_tmp = gpuarray.empty_like(gpu_in1)
      gpu_out1 = gpuarray.empty_like(gpu_in1)
      gpu_out2 = gpuarray.empty_like(gpu_in1)
      gpu_scale = gpuarray.zeros([1], np.int32)
      gpu_adjust = gpuarray.zeros([1], np.int32)
      gpu_adjust += scale_adjust
      gpu_a_trous_row_kernel, gpu_a_trous_col_kernel = gpu_a_trous()
      gpu_store_detail_coeffs = ker.get_function("gpu_store_detail_coeffs")
      grid_rows = int(in1.shape[0]//32)
      grid_cols = int(in1.shape[1]//32)
      if scale_adjust>0:
          for i in range(0, scale_adjust):
              gpu_a_trous_row_kernel(gpu_in1, gpu_tmp, wavelet_filter, gpu_scale,
                                  block=(32,32,1), grid=(grid_cols, grid_rows))
              gpu_a_trous_col_kernel(gpu_tmp, gpu_out1, wavelet_filter, gpu_scale,
                                  block=(32,32,1), grid=(grid_cols, grid_rows))
              gpu_in1, gpu_out1 = gpu_out1, gpu_in1
              gpu_scale += 1
      for i in range(scale_adjust, scale_count):
          gpu_a_trous_row_kernel(gpu_in1, gpu_tmp, wavelet_filter, gpu_scale,
                                  block=(32,32,1), grid=(grid_cols, grid_rows))
          gpu_a_trous_col_kernel(gpu_tmp, gpu_out1, wavelet_filter, gpu_scale,
                                  block=(32,32,1), grid=(grid_cols, grid_rows))
          gpu_a_trous_row_kernel(gpu_out1, gpu_tmp, wavelet_filter, gpu_scale,
                                  block=(32,32,1), grid=(grid_cols, grid_rows))
          gpu_a_trous_col_kernel(gpu_tmp, gpu_out2, wavelet_filter, gpu_scale,
                                  block=(32,32,1), grid=(grid_cols, grid_rows))
          gpu_store_detail_coeffs(gpu_in1, gpu_out2, detail_coeffs, gpu_scale, gpu_adjust,
                                  block=(32,32,1), grid=(grid_cols, grid_rows, int(scale_count)))
          gpu_in1, gpu_out1 = gpu_out1, gpu_in1
          gpu_scale += 1
      if store_on_gpu:
          return detail_coeffs
      elif store_smoothed:
          return detail_coeffs.get(), gpu_in1.get()
      else:
          return detail_coeffs.get()