willrichman willrichman - 1 month ago 10
iOS Question

How can I maintain a Tensorflow dependency in iOS and keep it portable?

I have questions about how to best integrate Tensorflow with my team's existing iOS application.

I am currently adding Tensorflow to an existing iOS project. I built the library for iOS following the instructions in the makefile README.md, and was able to compile successfully.

I have now been trying to follow the instructions here to get the library integrated. These instructions tell you to add search paths to a number of folders in your Tensorflow build, which will cause problems as I need this project to be easily sharable with my team in git. I would prefer to not have to force anyone else working on this to run a 20-plus minute build before they can get up and running.

The options I've considered are below:

Option 1: Embed the entire Tensorflow library

The problems here would be making the size of the project enormous. In addition, the build time will be significant and unnecessary. How often would we build to keep updated? I would like to avoid this.

Option 2: Link to separate Tensorflow project

With this option we would statically link to a peer project and have the same structure on each developer's machine. This seems to imply we'd have to have each team member pull and build the Tensorflow library before being able to build our project at all. Is there a way with this option to copy over only the necessary output files when they're updated by someone who has built Tensorflow while at the same time not requiring developers to build Tensorflow on their machine?

I'm also curious if there is a 3rd option I haven't considered here.

Answer

The usual way I think about this is by treating TensorFlow as a framework. That means that you need to build a copy once, and can then share the resulting files as something you can distribute to other developers in your organization.

You should just be able to zip up the folder you've built TF in (the directory you cloned from github) after you've built it, and then have other developers install it in a known location on their machine. I think this is what you're saying with option #2, but the difference is that other developers can avoid building it, unless they want to.

This also has the advantage that you can make sure your team members are all on the same TensorFlow version, to make debugging a bit easier.

Does that help?