错误信息如下:
2022-05-27 21:10:14.187608: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set. If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU. To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
这是由于没有安装tensorflow-gpu版本造成的。可以通过pip uninstall 卸载已有的tensorflow后,再通过命令pip install tensorflow-gpu==1.14.0 安装1.14版本或者其他版本。