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

ゝ一纸荒年。 2022-12-29 09:23 165阅读 0赞

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

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

但是出现

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

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

正确的应该如下:

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

发表评论

表情:
评论列表 (有 0 条评论,165人围观)

还没有评论,来说两句吧...

相关阅读