TensorFlow is an open source software library for high performance numerical
computation primarily used in machine learning. Its flexible architecture
allows easy deployment of computation across a variety of types of platforms
(CPUs, GPUs, TPUs), and a range of systems from single desktops to clusters
of servers to mobile and edge devices.

The build system of TensorFlow is Bazel (https://bazel.build/).

This layer integrates TensorFlow to OE/Yocto platform
- Integrate Google's bazel to Yocto
- Add Yocto toolchain for bazel to support cross compiling.
- Replace python package system(pip/wheel) with Yocto package system(rpm/deb/ipk).

URI: git://github.com/openembedded/openembedded-core.git
branch: master
revision: HEAD

URI: git://github.com/openembedded/bitbake.git
branch: master
revision: HEAD

URI: git://github.com/openembedded/meta-openembedded.git
layers: meta-python, meta-oe
branch: master
revision: HEAD

Source code

Maintainers: Hongxu Jia  | 

Contributions and patches can be sent to the Yocto Project mailing
list: yocto@yoctoproject.org"

When sending patches please take a look at the contribution guide available
here: https://wiki.yoctoproject.org/wiki/Contribution_Guidelines

git send-email -1 -M --to yocto@yoctoproject.org  --subject-prefix=meta-tensorflow][PATCH

- Bazel build takes lots of time, since it like bitbake which has own rules and builds
  everything from scratch. Currently bazel could not reuse Yocto DEPENDS/RDEPENDS.

- In order to run tensorflow cases in a reasonable time, although it builds
  successfully on qemuarm, qemuarm64, qemumips, qemumips64, qemux86 and qemux86-64,
  only qemux86-64 with kvm for runtime test.

- It failed to use pre-build model to do predict/inference on big-endian platform
  (such as qemumips), since upstream does not support big-endian very well

- Do not support 32-bit powerpc (qemuppc) since BoringSSL does not support it.
  (BoringSSL is a fork of OpenSSL used to implement cryptography and TLS across
  most of Google's products)

- If host is not x86_64, please add meta-java to BBLAYERS in conf/bblayers.conf

Future plan
- Support offline build which bazel build system fetches archive tarballs
  from Yocto download mirror.

- Introduce more machine learning cases to meta-tensorflow.

- Recipe maintenance and upgrade

Build and run
1. Clone away
$ mkdir 
$ cd 
$ git clone git://git.yoctoproject.org/meta-tensorflow
$ git clone git://git.openembedded.org/meta-openembedded
$ git clone git://git.openembedded.org/openembedded-core oe-core
$ cd oe-core
$ git clone git://git.openembedded.org/bitbake

2. Prepare build
$ . /oe-core/oe-init-build-env 

# Build qemux86-64 which runqemu supports kvm.
$ echo 'MACHINE = "qemux86-64"' >> conf/local.conf

$ echo 'IMAGE_INSTALL_append = " tensorflow"' >> conf/local.conf

Edit conf/bblayers.conf to include other layers
    /oe-core/meta \
    /meta-openembedded/meta-python \
    /meta-openembedded/meta-oe \
    /meta-tensorflow \

3. Build image in .
$ bitbake core-image-minimal

4. Start qemu with slrip + kvm + 5GB memory:
$ runqemu qemux86-64 core-image-minimal slirp kvm qemuparams="-m 5120"

5. Verify the install
root@qemux86-64:~# python3 -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
tf.Tensor(-604.65454, shape=(), dtype=float32)

6. Run tutorial case

root@qemux86-64:~# cat >code.py <