0
https://www.tensorflow.org/versions/master/experimental/xla/jitのように、JITコンパイルを使用して単純なテンソルフローの例を実行しようとしています。代わりにmnist_softmax_xlaサンプルの、私は次のコードを使用しています:XLAでTensorflowを実行中にエラーが発生する
def main(_):
config = tf.ConfigProto(log_device_placement=True)
jit_level = 0
if FLAGS.xla:
# Turns on XLA JIT compilation.
jit_level = tf.OptimizerOptions.ON_1
config.graph_options.optimizer_options.global_jit_level = jit_level
# Creates a session with log_device_placement set to True.
with tf.Session(config=config) as sess:
# Creates a graph.
with tf.device('/job:localhost/replica:0/task:0/device:XLA_CPU:0'):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
# Runs the op.
print(sess.run(c))
を私はエラーを取得しています:私は間違って
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device to node 'MatMul': Could not satisfy explicit device specification '/job:localhost/replica:0/task:0/device:XLA_CPU:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
[[Node: MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/device:XLA_CPU:0"](a, b)]]
何をしているのですか?
公式バイナリにはXLAが有効になっていません。ソースからビルドするか、他の人が構築したXLAバイナリを再利用する必要があります(つまり、https://github.com/yaroslavvb/tensorflow-community-wheelsから) –
私は彼女と一緒に仕事をします。彼女は '<その他のオプション> TF_ENABLE_XLA = 1。/ configure'を実行してTFをXLAで構築しています –