make code CudaTensor compatible