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
Objective-C
typedef void (^FIRModelInterpreterRunCallback)(FIRModelOutputs *_Nullable, NSError *_Nullable)
Parameters
outputs
An array of results of model inference. Returns nil when there is an error.
error
The error, if any, while running the custom model inference, including
MachineLearningErrorDomainCode.InvalidArgument
when:options
are nil.- Either input or outoutput data formats in
options
are 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.OutOfRange
when: - An input index in
options
is out of range. - An output index in
options
is out of range.MachineLearningErrorDomainCode.Unknown
when: - No output was generated by the custom model.
- There are no tensors matching an output index in the data options.
MachineLearningErrorDomainCode.Internal
when: - An input tensor cannot be located.
-
A block containing the index for an input or an output op.
Declaration
Objective-C
typedef void (^FIRModelInterpreterInputOutputOpIndexCallback)( NSNumber *_Nullable, NSError *_Nullable)
Parameters
index
The index, as an
unsignedIntValue
, for an input or output op ornil
if there was an error.error
An error while getting the index or
nil
.