可以使用以下代码来实现图像通道变换NHWC3ToNC3HW:int n = src.shape[0]; int c = src.shape[1]; int h = src.shape[2]; int w = src.shape[3];
float *data_src = (float *)src.data; float *data_dst = (float *)dst.data;
for(int i=0; i<n; i++){ for(int x=0; x<h; x++){ for(int y=0; y<w; y++){ for(int