源碼
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant("Hello TensorFlow")
sess = tf.compat.v1.Session()
print(sess.run(hello))
複製代碼
輸出
2021-05-10 01:03:24.797692: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-05-10 01:03:24.797925: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-05-10 01:03:24.798973: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:196] None of the MLIR optimization passes are enabled (registered 0 passes)
b'Hello TensorFlow'
複製代碼