FIRModelInterpreter


@interface FIRModelInterpreter : 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

    Objective-C

    + (nonnull instancetype)modelInterpreterWithOptions:
        (nonnull FIRModelOptions *)options;

    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.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Runs model inference with the given inputs and data options asynchronously. Inputs and data options should remain unchanged until the model inference completes.

    Declaration

    Objective-C

    - (void)runWithInputs:(nonnull FIRModelInputs *)inputs
                  options:(nonnull FIRModelInputOutputOptions *)options
               completion:(nonnull FIRModelInterpreterRunCallback)completion;

    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

    Objective-C

    - (void)inputIndexForOp:(nonnull NSString *)opName
                 completion:(nonnull FIRModelInterpreterInputOutputOpIndexCallback)
                                completion;

    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

    Objective-C

    - (void)outputIndexForOp:(nonnull NSString *)opName
                  completion:(nonnull FIRModelInterpreterInputOutputOpIndexCallback)
                                 completion;

    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.