MNN icon indicating copy to clipboard operation
MNN copied to clipboard

iphone上运行 fp16 的模型失败Unsupported data type

Open Ajay-Wong opened this issue 11 months ago • 2 comments

平台(如果交叉编译请再附上交叉编译目标平台):

Platform(Include target platform as well if cross-compiling):

macOS: 13.2.1-arm64 CLT: 14.2.0.0.1.1668646533 Xcode: 14.2 iphone 11

Github版本:

Github Version:

ffde3f423da2f0ccd715e86b8c8e9f4e5c359060 直接下载ZIP包请提供下载日期以及压缩包注释里的git版本(可通过7z l zip包路径命令并在输出信息中搜索Comment 获得,形如Comment = bc80b11110cd440aacdabbf59658d630527a7f2b)。 git clone请提供 git commit 第一行的commit id

Provide date (or better yet, git revision from the comment section of the zip. Obtainable using 7z l PATH/TO/ZIP and search for Comment in the output) if downloading source as zip,otherwise provide the first commit id from the output of git commit

编译方式:

Compiling Method

请在这里粘贴cmake参数或使用的cmake脚本路径以及完整输出
Paste cmake arguments or path of the build script used here as well as the full log of the cmake proess here or pastebin

编译日志:

Build Log:

粘贴在这里
Paste log here or pastebin

2024-03-20 11:01:29.470990+0800 demo[11091:455336] Unsupported data type! Unsupported data type!2024-03-20 11:01:29.471161+0800 demo[11091:455336] Error for /Users/wzj/Codes/virtual-human/inf/MNN/source/core/Tensor.cpp, 241 Error for /Users/wzj/Codes/virtual-human/inf/MNN/source/core/Tensor.cpp, 241 Assertion failed: (res), function setType, file Tensor.cpp, line 241.

我看了下代码的位置,看着确实没有 fp16 类型的支持: void Tensor::setType(int type) { auto nativeDescribe = mDescribe->mContent.get(); switch (type) { case DataType_DT_DOUBLE: case DataType_DT_FLOAT: mBuffer.type = halide_type_of<float>(); break; case DataType_DT_BFLOAT16: mBuffer.type = halide_type_t(halide_type_bfloat, 16); break; case DataType_DT_QINT32: case DataType_DT_INT32: case DataType_DT_BOOL: case DataType_DT_INT64: mBuffer.type = halide_type_of<int32_t>(); break; case DataType_DT_QINT8: case DataType_DT_INT8: mBuffer.type = halide_type_of<int8_t>(); break; case DataType_DT_QUINT8: case DataType_DT_UINT8: mBuffer.type = halide_type_of<uint8_t>(); break; case DataType_DT_QUINT16: case DataType_DT_UINT16: mBuffer.type = halide_type_of<uint16_t>(); break; case DataType_DT_QINT16: case DataType_DT_INT16: mBuffer.type = halide_type_of<int16_t>(); break; default: MNN_PRINT("Unsupported data type!"); MNN_ASSERT(false); break; } }

但是实际上整个的数据类型里面是有 half 的 enum DataType { DataType_DT_INVALID = 0, DataType_DT_FLOAT = 1, DataType_DT_DOUBLE = 2, DataType_DT_INT32 = 3, DataType_DT_UINT8 = 4, DataType_DT_INT16 = 5, DataType_DT_INT8 = 6, DataType_DT_STRING = 7, DataType_DT_COMPLEX64 = 8, DataType_DT_INT64 = 9, DataType_DT_BOOL = 10, DataType_DT_QINT8 = 11, DataType_DT_QUINT8 = 12, DataType_DT_QINT32 = 13, DataType_DT_BFLOAT16 = 14, DataType_DT_QINT16 = 15, DataType_DT_QUINT16 = 16, DataType_DT_UINT16 = 17, DataType_DT_COMPLEX128 = 18, DataType_DT_HALF = 19, DataType_DT_RESOURCE = 20, DataType_DT_VARIANT = 21, DataType_MIN = DataType_DT_INVALID, DataType_MAX = DataType_DT_VARIANT };

Ajay-Wong avatar Mar 20 '24 03:03 Ajay-Wong

mnn 版本是什么?

jxt1234 avatar Apr 16 '24 07:04 jxt1234

mnn 版本是什么?大概率是 ios 上的 mnn 版本较低

jxt1234 avatar Apr 16 '24 07:04 jxt1234

Marking as stale. No activity in 60 days.

github-actions[bot] avatar Jun 15 '24 09:06 github-actions[bot]