code: def tv2(data,weight,Niter=50):
      
  
      prog = OCLProgram(abspath("kernels/tv2.cl"))
  
      data_im = OCLImage.from_array(data.astype(np,float32,copy=False))
  
      pImgs = [ dev.createImage(data.shape[::-1],
                                    mem_flags = cl.mem_flags.READ_WRITE,
                                    dtype= np.float32,
                                    channel_order = cl.channel_order.RGBA)
                                    for i in range(2)]
  
      outImg = dev.createImage(data.shape[::-1],
                               dtype = np.float32,
                               mem_flags = cl.mem_flags.READ_WRITE)
  
  
      dev.writeImage(inImg,data.astype(np.float32));
      dev.writeImage(pImgs[0],np.zeros((4,)+data.shape,dtype=np.float32));
      dev.writeImage(pImgs[1],np.zeros((4,)+data.shape,dtype=np.float32));
  
  
      for i in range(Niter):
          proc.runKernel("div_step",inImg.shape,None,
                             inImg,pImgs[i%2],outImg)
          proc.runKernel("grad_step",inImg.shape,None,
                             outImg,pImgs[i%2],pImgs[1-i%2],
                             np.float32(weight))
      return dev.readImage(outImg,dtype=np.float32)
docs: chambolles tv regularized denoising
  
      weight should be around  2+1.5*noise_sigma