首页 > 解决方案 > TensorFlow XLA 是否已弃用?

问题描述

我刚刚读到(这里):

在此版本中弃用 XLA_CPU 和 XLA_GPU 设备。(TF 2.2.0)

XLA 现在被弃用了吗?它不再使用了吗?有替代方案吗?还是这一切都是在内部自动处理的?这种弃用是什么意思?

标签: tensorflowtensorflow2.xtensorflow-xla

解决方案


不,XLA 并没有被弃用,事实上还有其他关于它的发行说明:

该注释实际上与您提到的弃用有关。不推荐使用的是使用字符串XLA_CPUXLA_GPUwith tf.device。请参阅弃用警告消息

XLA_GPU and XLA_CPU devices are deprecated and will be
removed in subsequent releases. Instead, use either
@tf.function(experimental_compile=True) for must-compile
semantics, or run with TF_XLA_FLAGS=--tf_xla_auto_jit=2
for auto-clustering best-effort compilation.

这就是另一个发行说明所讨论的内容,在 XLA 指南中使用 tf.function 显式编译下提到了这一点。


推荐阅读