Skip to content
Philip Dow edited this page Nov 30, 2020 · 19 revisions

Welcome to the tensorflow-ios-framework wiki!

First Time Configuration

You're going to be compiling Tensorflow on macOS. If this is your first time compiling Tensorflow, you'll need to do a couple things first.

Install Xcode and ensure you have a simulator installed in the Components preferences.

Install the Xcode command line tools. If you've already been using Xcode you should already have these installed. If not, continue.

Install Homebrew. As part of its installation the Xcode command line tools will also be installed.

After installing Homebrew, xcode-select may point to the wrong active developer directory, which controls which copy of the developer tools are used. Reset to the default directory and confirm it is correct:

$ sudo xcode-select -r
$ sudo xcode-select -p
/Applications/Xcode.app/Contents/Developer

You should see some path with Xcode.app in it and not /Library/Developer/CommandLineTools.

Next use brew to install a number of additional utilities:

$ brew install automake
$ brew install libtool

Building Tensorflow

Clone doc.ai's Custom build of Tensorflow and switch to the active custom development branch, currently r2.0.doc.ai.

Change directories into tensorflow/contrib/makefile/ and run the following command:

$ ./build_all_ios.sh

Compile time is roughly 30 minutes on a top of the line iMac, so grab yourself a cup of coffee and come back.

When finished you'll find the build output in the gen directory, with the tensorflow build at gen/lib.

The protobuf library can be found at gen/protobuf_ios/lib.

The nysnc library be found at downloads/nsync/builds/lipo.ios.c++11.

Composing the Framework

Once the build is complete you can compose this framework by running the following script from the same directory:

$ ./create_full_ios_frameworks.sh

The framework will be placed in the local gen/ios_frameworks directory.

Customizing Available Ops

Add the op's op file and kernel file to tf_op_files.txt and rebuild.

Learn more about customizing the ops in your build.

~

Last updated 6/12/20

Clone this wiki locally