我刚刚升级到 Xcode 10.0,它似乎破坏了 CoreML 自动生成的网络类代码。构建项目时,我收到错误:
reg_net.m:94:50:“reg_netInput”没有可见的@interface 声明选择器“initWith0:”
在类内部,自动生成的 reg_netInput
初始化器具有 initWith_0
的形式,但在预测函数的主体中,代码调用 initWith0
。我试图将初始化程序名称更改为一致,但每当我构建时,代码似乎会再次自动生成并恢复为冲突的名称。
我也曾尝试删除并重新导入 .mlmodel 文件,但没有成功。关于如何解决此问题的任何想法?
最佳答案
尝试通过不同于数字“0”
的有效标识符
更改模型的输入名称。
Overview
In Core ML, a feature is a single input or output of a model. A model can have any number of input features or output features. Each feature has a name and a value type, which are defined in the feature's MLFeatureDescription. Model authors use feature descriptions to help developers integrate their model properly. Each MLFeatureDescription instance has read-only properties that indicate the feature's name, its type, and whether it's optional.
For examples of features, see Integrating a Core ML Model into Your App. Note the three input features named solarPanels, greenhouses, and size, and the output feature is named price. All four features are of type Double.
An MLFeatureDescription may also include constraints, which specify the limitations of the model's input and output features. For each input feature, the constraints describe what values the model expects from your app. For each output feature, the constraints describe what values your app should expect from the model. You can also write code to inspect these descriptions before using the model in your app.
Topics Inspecting a Feature var name: String
The name of this feature.
关于ios - 自动生成的 CoreML 类使用了冲突的初始值设定项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52447905/