Skip to content

Instantly share code, notes, and snippets.

@SnowMasaya
Created March 20, 2017 23:33
Show Gist options
  • Save SnowMasaya/d5c20bd2b6688383e84f22d1d53249a0 to your computer and use it in GitHub Desktop.
Save SnowMasaya/d5c20bd2b6688383e84f22d1d53249a0 to your computer and use it in GitHub Desktop.
Tensorflow XLAによる高速化、メモリ効率化、サイズの最適化によるポータビリティ向上について ref: http://qiita.com/GushiSnow/items/a373b8d5d904566f65fd
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N]
# Config to turn on JIT compilation
config = tf.ConfigProto()
config.graph_options.optimizer_options.global_jit_level = tf.OptimizerOptions.ON_1
sess = tf.Session(config=config)
jit_scope = tf.contrib.compiler.jit.experimental_jit_scope
x = tf.placeholder(np.float32)
with jit_scope():
y = tf.add(x, x) # The "add" will be compiled with XLA.
with tf.device("/job:localhost/replica:0/task:0/device:XLA_GPU:0"):
output = tf.add(input1, input2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment