无法在 ARM64 (Xcode 12.5) 的 Objective-C 上正确启用 XNNPACK (TFLite)

问题描述

了解到 XNNPACK 通常可以大大加速计算,因此在 Xcode/Objective-C 上进行了尝试。根据官方文档,这是小鬼

// add XNNPACK
TFLInterpreterOptions *options = [[TFLInterpreterOptions alloc] init];
options.useXNNPACK = YES;
    
// init interpreter
Nsstring *modelPath = [[NSBundle mainBundle] pathForResource:@"mymodel" ofType:@"tflite"];
_modelInterpreter = [[TFLInterpreter alloc] initWithModelPath:modelPath
                                                      options:options
                                                        error:&error];

使用 CocoaPods,我尝试使用 TensorFlowLite 2.3.0、2.4.0 和最新的 x.x.x-nighly 版本。在所有情况下,无论何时启用 XNNPACK,init 都会失败。在内部,它在 TFLInterpreter.mm 中的这一行失败:

_interpreter = TfLiteInterpreterCreate(model,coptions);

我是不是遗漏了什么,或者只是 XNNPACK 没有在库中正确实现?

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)