memcpy(input_tensor, image.data, image.total() * image.elemSize()) core dumped

//以下写法 core dumped

float* input_tensor = interpreter->typed_input_tensor<float>(0);
memcpy(input_tensor, image.data, image.total() * image.elemSize());

//修改过的写法 正确

float *input_tensor = interpreter->typed_input_tensor<float>(0);
for(int i=0;i<image.cols * image.rows * 3;i++){
    //input_tensor[i] = image.data[i]/255.0;
    input_tensor[i] = image.data[i];
}

不知道上面一种写法到底错在哪里了, 欢迎跟贴讨论

你可能感兴趣的:(C/C++,gdb,gcc/g++)