The following protocols are available globally.
TIODatais any data type that knows how to provide bytes to a input tensor and how to read bytes from an output tensor.
@protocol TIOData <NSObject>
protocol TIOData : NSObjectProtocol
Describes an input or output layer. Used internally by a model when parsing its description.
A layer description encapsulates information about an input or output tensor that is needed to prepare obj-c data and copy bytes into and out of it. For example, a vector layer description for an input tensor describes any transformations the submitted data must undergo before the underlying bytes are copied to the tensor, e.g. quantization and normalization, as well as the shape of the expected input, which determines how many bytes are copied into the tensor.See more
@protocol TIOLayerDescription <NSObject>
protocol TIOLayerDescription : NSObjectProtocol
An Obj-C wrapper around lower level, usually C++ model implementations. This is the primary API provided by the TensorIO framework.
TIOModelis built from a bundle folder that contains the underlying model, a json description of the model’s input and output layers, and any additional assets required by the model, for example, output labels.
TIOModelbegins by parsing a json description of the model’s input and output layers, producing a
TIOLayerInterfacefor each layer. Each layer is fully described by a conforming
TIOLayerDescription, which describes the data the layer expects or produces, for example, whether it is quantized, any transformations that should be applied to it, and the number of bytes the layer expects.
To perform inference with the underlying model, call
runOn:with a conforming
TIODataobjects simply know how to copy bytes to and receive bytes from a model’s input and output layers. Internally, this method matches
TIODataobjects with their corresponding layers and ensures that bytes are copied to the right place. The
runOn:method then returns a conforming
TIODataobject, which is the result of performing inference with the model. Objects that conform to the
TIOPixelBuffer, which wraps a
CVPixelBufferfor computer vision models.
For more information about a model’s interface, refer to the
TIOLayerDescriptionclasses. For more information about the kinds of Objective-C data a
TIOModelcan work with, refer to the
TIODataprotocol and its conforming classes. For more information about the JSON file which describes a model, see TIOModelBundleJSONSchema.h
Note that, currently, only TensorFlow Lite (TFLite) models are supported.
@warning Models are not thread safe. Models may be used on separate threads, so that you can perform inference off the main thread, but you should not use the same model from multiple threads.See more
@protocol TIOModel <NSObject>
protocol TIOModel : NSObjectProtocol