Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
链接到外部Bazel依赖项 问题 我试图修改编译一个TysFROUM网络,用于C++。目前,它要求您将网络文件复制到TensorFlow源代码中,以便找到依赖项,但我不希望这样做。请注意,TensorFlow也是使用Bazel构建的_Bazel - Fatal编程技术网

链接到外部Bazel依赖项 问题 我试图修改编译一个TysFROUM网络,用于C++。目前,它要求您将网络文件复制到TensorFlow源代码中,以便找到依赖项,但我不希望这样做。请注意,TensorFlow也是使用Bazel构建的

链接到外部Bazel依赖项 问题 我试图修改编译一个TysFROUM网络,用于C++。目前,它要求您将网络文件复制到TensorFlow源代码中,以便找到依赖项,但我不希望这样做。请注意,TensorFlow也是使用Bazel构建的,bazel,Bazel,这是我的构建文件: cc_binary( name = "mnistpredict_keras", srcs = ["mnist_keras.cc", "MNIST.h"], deps = [ "//tensorflow/core:tensorflow", ], ) 当我尝试运行$bazel build:mnistpredict\u keras时,我得到错误: ERROR: /home/saubin/git/tf-keras-speed-test

这是我的
构建
文件:

cc_binary(
    name = "mnistpredict_keras",
    srcs = ["mnist_keras.cc", "MNIST.h"],
    deps = [
        "//tensorflow/core:tensorflow",
    ],
)
当我尝试运行
$bazel build:mnistpredict\u keras
时,我得到错误:

ERROR: /home/saubin/git/tf-keras-speed-test/loadgraph/BUILD:17:1: no such package 'tensorflow/core': BUILD file not found on package path and referenced by '//:mnistpredict_keras'.
ERROR: Analysis of target '//:mnistpredict_keras' failed; build aborted.
INFO: Elapsed time: 0.105s
显然,问题是我试图在我的文件夹
~/git/tf keras speed test/loadgraph
中编译一些东西,但它找不到依赖项
//tensorflow/core:tensorflow
。如何正确地给出依赖项的路径?的文档似乎不存在

尝试的解决方案
向我的
工作区添加
本地存储库

local_repository(
    name = "tensorflow",
    path = "/home/saubin/src/tensorflow",
)
这并没有改变什么


正在尝试通过完整路径:

cc_binary(
    name = "mnistpredict_keras",
    srcs = ["mnist_keras.cc", "MNIST.h"],
    deps = [
        "/home/saubin/src/tensorflow/tensorflow/core:tensorflow",
    ],
)
但我得到了同样的错误:

ERROR: /home/saubin/git/tf-keras-speed-test/loadgraph/BUILD:17:1: no such package 'tensorflow/core': BUILD file not found on package path and referenced by '//:mnistpredict_keras'.
ERROR: Analysis of target '//:mnistpredict_keras' failed; build aborted.
INFO: Elapsed time: 0.287s

将TensorFlow标记为:

但这给了我一个错误:

WARNING: /home/saubin/.cache/bazel/_bazel_saubin/74f664e7cf53364557da8b57a716c919/external/tensorflow/WORKSPACE:1: Workspace name in /home/saubin/.cache/bazel/_bazel_saubin/74f664e7cf53364557da8b57a716c919/external/tensorflow/WORKSPACE (@org_tensorflow) does not match the name given in the repository's definition (@tensorflow); this will cause a build error in future versions.
ERROR: /home/saubin/git/tensorgraph/loadgraph/BUILD:1:1: error loading package '@tensorflow//tensorflow/core': Encountered error while reading extension file 'sycl/build_defs.bzl': no such package '@local_config_sycl//sycl': error loading package 'external': The repository named 'local_config_sycl' could not be resolved and referenced by '//:mnistpredict'.
ERROR: Analysis of target '//:mnistpredict' failed; build aborted.
INFO: Elapsed time: 0.326s

外部依赖关系的文档是

您要查找的语法是
@tensorflow//tensorflow/core:tensorflow


/
开头的标签引用当前存储库。以
@reponame/
开头的标签引用reponame存储库。

这可能是正确的,但我仍然收到一个可能是TensorFlow特定的错误。请参阅更新后的帖子。错误消息会告诉您错误:名为“local_config_sycl”的存储库无法解析并由“/:mnistpredict”引用。这是因为bazel不会以传递方式加载工作区。您的工作区依赖于tensorflow工作区,但tensorflow工作区也依赖于其他工作区。即@local_config_sycl/。Tensorflow在这里定义了这个工作区:它是从中调用的。所以我应该在工作区中导入Tensorflow的所有外部dep?如果您试图引用Tensorflow作为外部存储库,那么是的。如果遇到更多问题,请打开一个单独的StackOverflow问题。
WARNING: /home/saubin/.cache/bazel/_bazel_saubin/74f664e7cf53364557da8b57a716c919/external/tensorflow/WORKSPACE:1: Workspace name in /home/saubin/.cache/bazel/_bazel_saubin/74f664e7cf53364557da8b57a716c919/external/tensorflow/WORKSPACE (@org_tensorflow) does not match the name given in the repository's definition (@tensorflow); this will cause a build error in future versions.
ERROR: /home/saubin/git/tensorgraph/loadgraph/BUILD:1:1: error loading package '@tensorflow//tensorflow/core': Encountered error while reading extension file 'sycl/build_defs.bzl': no such package '@local_config_sycl//sycl': error loading package 'external': The repository named 'local_config_sycl' could not be resolved and referenced by '//:mnistpredict'.
ERROR: Analysis of target '//:mnistpredict' failed; build aborted.
INFO: Elapsed time: 0.326s