how to use xla with c++ api in tensorflow

1.8k Views Asked by At

Tensorflow give a way to run tensorflow graph via XLA,however, it mention nothing about how to run tensorflow graph via XLA using c++ api. Counld someone give me some advise?

2

There are 2 best solutions below

0
On

The guide Using AOT compilation might not be very clear in each steps. You can try

  1. bazel build tensorflow/compiler/aot/tests:tfcompile_test

  2. bazel-bin/tensorflow/compiler/aot/tests/tfcompile_test

as an example.

0
On

The other answers so far are of AOT compilation, while I believe JIT is needed in most of times. XLA JIT can be turned on with environment variable. Try using TF_XLA_FLAGS="--tf_xla_auto_jit=1".