ModelInterpreter

class ModelInterpreter : NSObject

A Firebase interpreter for a custom model.

  • Gets an instance of a custom model interpreter with the given options and the default Firebase app. The default Firebase app instance must be configured before calling this method; otherwise, raises FIRAppNotConfigured exception. The returned interpreter is thread safe. Custom models hosted in non-default Firebase apps are currently not supported.

    Declaration

    Swift

    class func modelInterpreter(options: FIRModelOptions) -> Self

    Parameters

    options

    The options of the custom model file.

    Return Value

    A custom model interpreter with the given options and the default Firebase app.

  • Unavailable.

  • Runs model inference with the given inputs and data options asynchronously. Inputs and data options should remain unchanged until the model inference completes.

    Declaration

    Swift

    func run(inputs: FIRModelInputs, options: FIRModelInputOutputOptions, completion: @escaping ModelInterpreterRunCallback)

    Parameters

    inputs

    Inputs for custom model inference.

    options

    Data options for the custom model specifiying input and output data types and dimensions.

    completion

    Handler to call back on the main thread with ModelOutputs or error.

  • Gets the index of an input op with the given name.

    Declaration

    Swift

    func inputIndex(opName: String, completion: @escaping ModelInterpreterInputOutputOpIndexCallback)

    Parameters

    opName

    The name of the input op.

    completion

    Handler to call back on the main thread with input op index as an unsignedIntValue or error.

  • Gets the index of an output op with the given name.

    Declaration

    Swift

    func outputIndex(opName: String, completion: @escaping ModelInterpreterInputOutputOpIndexCallback)

    Parameters

    opName

    The name of the output op.

    completion

    Handler to call back on the main thread with output op index as an unsignedIntValue or error.