IOS 预测应用在预测 IOS14 中的 .mlmodel 时抛出错误

IOS prediction app throws error to predict the .mlmodel in IOS14

我尝试使用我的 .ml 模型对 IOS14 进行预测,方法与下面苹果文档 link 中描述的方法相同: https://developer.apple.com/documentation/coreml/integrating_a_core_ml_model_into_your_app

我遇到以下错误。我不明白哪里出了问题。我的两个输入和输出都按预期设置,模型似乎从 TF2 正确转换为 mlmodel。对如何分析和解决问题有什么建议吗?

/Library/Caches/com.apple.xbs/Sources/MetalImage/MetalImage-124.0.29/MPSNeuralNetwork/Filters/MPSCNNKernel.mm:752:断言失败`[MPSCNNConvolution encode...]错误:目的地可能不是零。

这是 Metal 的一个错误,用于 运行 GPU 上的模型。您可以在 CPU 上尝试 运行ning 它,看看它是否可以正常工作。 (如果 CPU 上的 运行ning 也给出错误,说明你的模型有问题。)

let config = MLModelConfiguration()
config.computeUnits = .cpuOnly

let model = YourModel(configuration: config)
...