TensorFlowLiteSwift Framework Reference

Interpreter

public final class Interpreter

A TensorFlow Lite interpreter that performs inference from a given model.

  • The configuration options for the Interpreter.

    Declaration

    Swift

    public let options: Options?
  • An Array of Delegates for the Interpreter to use to perform graph operations.

    Declaration

    Swift

    public let delegates: [Delegate]?
  • The total number of input Tensors associated with the model.

    Declaration

    Swift

    public var inputTensorCount: Int { get }
  • The total number of output Tensors associated with the model.

    Declaration

    Swift

    public var outputTensorCount: Int { get }
  • Creates a new instance with the given values.

    Throws

    An error if the model could not be loaded or the interpreter could not be created.

    Declaration

    Swift

    public init(modelPath: String, options: Options? = nil, delegates: [Delegate]? = nil) throws

    Parameters

    modelPath

    The local file path to a TensorFlow Lite model.

    options

    Configurations for the Interpreter. The default is nil indicating that the Interpreter will determine the configuration options.

    delegate

    Array of Delegates for the Interpreter to use to perform graph operations. The default is nil.

  • Invokes the interpreter to perform inference from the loaded graph.

    Throws

    An error if the model was not ready because the tensors were not allocated.

    Declaration