STT-tensorflow/tensorflow/lite/objc
A. Unique TensorFlower 0cbbd15f48 Move type declarations needed by C API into separate header file
c_api_types.h

The aim here is to remove the dependency on common.h from the C API,
so that the C API depends on abstract types and enums as much as possible,
without any need to include the header files that define the concrete
struct types.

The one non-opaque type is TFLiteQuantizationParams, which is used as a return type in the C API and therefore can't be made opaque.

PiperOrigin-RevId: 347654215
Change-Id: I5cdd44624731e95b2ea477f3f86b77b18c669487
2020-12-15 11:49:24 -08:00
..
apis
apps/TestApp
sources
TensorFlowLite.tulsiproj
tests
BUILD.apple
README.md
TensorFlowLiteObjC.podspec Move type declarations needed by C API into separate header file 2020-12-15 11:49:24 -08:00
TensorFlowLiteObjC.podspec.template Move type declarations needed by C API into separate header file 2020-12-15 11:49:24 -08:00

TensorFlow Lite for Objective-C

TensorFlow Lite is TensorFlow's lightweight solution for Objective-C developers. It enables low-latency inference of on-device machine learning models with a small binary size and fast performance supporting hardware acceleration.

Build TensorFlow with iOS support

To build the Objective-C TensorFlow Lite library on Apple platforms, install from source or clone the GitHub repo. Then, configure TensorFlow by navigating to the root directory and executing the configure.py script:

python configure.py

Follow the prompts and when asked to build TensorFlow with iOS support, enter y.

CocoaPods developers

Add the TensorFlow Lite pod to your Podfile:

pod 'TensorFlowLiteObjC'

Then, run pod install.

In your Objective-C files, import the umbrella header:

#import "TFLTensorFlowLite.h"

Or, the module if you set CLANG_ENABLE_MODULES = YES in your Xcode project:

@import TFLTensorFlowLite;

Note: To import the TensorFlow Lite module in your Objective-C files, you must also include use_frameworks! in your Podfile.

Bazel developers

In your BUILD file, add the TensorFlowLite dependency to your target:

objc_library(
  deps = [
      "//tensorflow/lite/objc:TensorFlowLite",
  ],
)

In your Objective-C files, import the umbrella header:

#import "TFLTensorFlowLite.h"

Or, the module if you set CLANG_ENABLE_MODULES = YES in your Xcode project:

@import TFLTensorFlowLite;

Build the TensorFlowLite Objective-C library target:

bazel build tensorflow/lite/objc:TensorFlowLite

Build the Tests target:

bazel test tensorflow/lite/objc:Tests

Generate the Xcode project using Tulsi

Open the //tensorflow/lite/objc/TensorFlowLite.tulsiproj using the TulsiApp or by running the generate_xcodeproj.sh script from the root tensorflow directory:

generate_xcodeproj.sh --genconfig tensorflow/lite/objc/TensorFlowLite.tulsiproj:TensorFlowLite --outputfolder ~/path/to/generated/TensorFlowLite.xcodeproj