terminate called after throwing an instance of ‘std::runtime_error‘ what(): numpy type does not m

在MNN的python中想转numpy数组为tensor对象

MNN.Tensor((1,224, 224,3), MNN.Halide_Type_Float,image,MNN.Tensor_DimensionType_Tensorflow)

但是出现

terminate called after throwing an instance of 'std::runtime_error'
  what():  numpy type does not match
Aborted (core dumped)

原因是数据类型不正确,因为image里面装的uint8类型的数据,所以不匹配

正确的应该如下:

MNN.Tensor((1,224, 224,3), MNN.Halide_Type_Uint8,image,MNN.Tensor_DimensionType_Tensorflow)

猜你喜欢

转载自blog.csdn.net/zhou_438/article/details/111478969