Hi, I’m a newbie to TVM, and found TVM could be a general solution to performance tuning not only for NN model. I tried to start from color space transformation and need your help.
With Numpy, rgb2yuv could be implemented like below, how can it be done with TVM? Numpy version:
def rgb2yuv(rgb): m = np.array([ [0.29900, -0.147108, 0.614777], [0.58700, -0.288804, -0.514799], [0.11400, 0.435912, -0.099978] ]) yuv = np.dot(rgb, m) yuv[:,:,1:] += 0.5 return yuv
My not working version(wsn’t able to find a way to update [i,i,:] at once ):
w=h=32 c=3 rgb = te.placeholder((w,h,c), name='rgb') def rgb2yuv(i,j,k): return rgb[i,j,0],rgb[i,j,1],rgb[i,j,2] // caculation formula ignored yuv = te.compute((w,h,c), lambda i,j,k:rgb2yuv(i,j,k), name='yuv')