首页 > 解决方案 > Tensorflow tfcompile:第 2 步失败

问题描述

我关注https://www.tensorflow.org/xla/tfcompile,但在第 2 步失败。

怎么了?

~/git/tensorflow$ bazel build --config=opt //t1:test_graph_tfmatmul ... 信息:在文件 /home/cschen/git/tensorflow/.bazelrc 中找到适用的配置定义 build:download_clang:--crosstool_top=@local_config_download_clang //:工具链 --define=using_clang=true --action_env TF_DOWNLOAD_CLANG=1 信息:找到适用的配置定义构建:在文件 /home/cschen/git/tensorflow/.tf_configure.bazelrc 中选择:--copt=-march=native --copt=-Wno-sign-compare --host_copt=-march=native --define with_default_optimizations=true 信息:构建选项 --cpu 已更改,丢弃分析缓存。错误:目标 '//t1:test_graph_tfmatmul' 的分析失败;构建中止:没有这样的包'tools/target_cpu':在包路径上找不到BUILD文件......

我从第 2 步复制到t1/BUILD,如下所示,

~/git/tensorflow$ cat t1/BUILD load("//tensorflow/compiler/aot:tfcompile.bzl", "tf_library") ...

预期的结果是生成头文件test_graph_tfmatmul.h

标签: tensorflow-xla

解决方案


我不知道您使用的是哪个版本,但是在 TF1.14 上,如果您使用git grep tools/target_cpu,您将在文件中看到一个结果tensorflow/compiler/aot/tfcompile.bzl

在目录tools中,没有任何让人联想到的东西target_cpu,所以我想这一定是个bug tfcompile.bzl。当我注释掉引用工具/target_cpu 的行时,问题就消失了。


推荐阅读