Type Definitions
The following type definitions are available globally.
-
A block containing an array of custom model inference outputs, or nil if there’s an error.
Declaration
Swift
typealias ModelInterpreterRunCallback = (FIRModelOutputs?, Error?) -> VoidParameters
outputsAn array of results of model inference. Returns nil when there is an error.
errorThe error, if any, while running the custom model inference, including
MachineLearningErrorDomainCode.InvalidArgumentwhen:optionsare nil.- Either input or outoutput data formats in
optionsare empty. - The number of inputs do not match the data options.
- The input byte buffer does not have the expected size.
- The input data is neither a byte buffer (
NSData) nor an array. - The input dimension does not match the input format specified in
options. - The input element type in the data options is unexpected.
- The input element type is not a number as specified in the data options.
- The input type specified in the data options does not match the model.
- Dimension of input data does not match the data options.
- An element type in the data options does not match the actual output.
- The total size in bytes specified in the data options does not match the actual output.
- The number of dimensions in the data options does not match the actual output.
- The shape in the data optinos does not match the actual output.
- The output element type in the data options is unexpected.
MachineLearningErrorDomainCode.OutOfRangewhen: - An input index in
optionsis out of range. - An output index in
optionsis out of range.MachineLearningErrorDomainCode.Unknownwhen: - No output was generated by the custom model.
- There are no tensors matching an output index in the data options.
MachineLearningErrorDomainCode.Internalwhen: - An input tensor cannot be located.
-
A block containing the index for an input or an output op.
Declaration
Swift
typealias ModelInterpreterInputOutputOpIndexCallback = (NSNumber?, Error?) -> VoidParameters
indexThe index, as an
unsignedIntValue, for an input or output op ornilif there was an error.errorAn error while getting the index or
nil.