运行代码出现
I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
以为是网上说的CUDA tensorflow-gpu 版本的问题
可看后面,gpu还是正常运行了的
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce RTX 2060 with Max-Q Design computeCapability: 7.5
coreClock: 1.185GHz coreCount: 30 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 245.91GiB/s
查了查 tensorflow前面的那个“I”是 information log message的意思,不算是error,程序还是可以正常运行的
那怎么把这碍眼的东西解决呢?
解决方法参考:https://stackoverflow.com/questions/65907365/tensorflow-not-creating-xla-devices-tf-xla-enable-xla-devices-not-set
第一种方法:在代码开头加一行:
os.environ[‘TF_XLA_FLAGS’] = ‘–tf_xla_enable_xla_devices’
第二种方法:添加windows系统环境变量
TF_XLA_FLAGS = --tf_xla_enable_xla_devices.
本人使用第一种方法解决。