当我使用bazel在Android上运行tensorflow lite的benmark_model时,会打印以下错误:
$ bazel build -c opt --cxxopt='--std=c++11' \
//tensorflow/contrib/lite/tools:benchmark_model \
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
--cpu=arm64-v8a --verbose_failures
WARNING: /home/libin11/.cache/bazel/_bazel_libin11/ee99114ce55f575758aad31c3fa3e774/external/protobuf_archive/WORKSPACE:1: Workspace name in /home/libin11/.cache/bazel/_bazel_libin11/ee99114ce55f575758aad31c3fa3e774/external/protobuf_archive/WORKSPACE (@com_google_protobuf) does not match the name given in the repository's definition (@protobuf_archive); this will cause a build error in future versions
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:avgpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:batch_util.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:bounds_check.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_gradients.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_activations.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_attention.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_cuboid_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_cuboid_convolution.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_pooling.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_softmax.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_volume_patch.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:maxpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.cc' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:padding_fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.cc' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_base.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_op.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:typed_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_entry.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_scorer.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_search.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_decoder.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_loss_util.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.cc' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.cc' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/libin11/workspace/tensorflow/tensorflow/core/BUILD:1245:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.h' directly. You should either move the file to this package or depend on an appropriate rule there
INFO: Analysed target //tensorflow/contrib/lite/tools:benchmark_model (0 packages loaded).
INFO: Found 1 target...
ERROR: /home/libin11/.cache/bazel/_bazel_libin11/ee99114ce55f575758aad31c3fa3e774/external/jpeg/BUILD:288:1: undeclared inclusion(s) in rule '@jpeg//:simd_armv8a':
this rule is missing dependency declarations for the following files included by 'external/jpeg/simd/jsimd_arm64.c':
'/home/libin11/.cache/bazel/_bazel_libin11/ee99114ce55f575758aad31c3fa3e774/external/jpeg/jpegint.h'
'/home/libin11/.cache/bazel/_bazel_libin11/ee99114ce55f575758aad31c3fa3e774/external/jpeg/jerror.h'
Target //tensorflow/contrib/lite/tools:benchmark_model failed to build
INFO: Elapsed time: 0.411s, Critical Path: 0.13s
INFO: 5 processes, local.
FAILED: Build did NOT complete successfully
我使用的是Ubuntu 16.04,tensorflow r1.8,bazel 0.13.0,android-ndk-r15c,android-sdk-27。 我需要根据我的实现对tensorflow lite进行基准测试。我搜遍谷歌和stackoverflow,但没有人说有关构建tensorflow lite的benchmark_model。
答案 0 :(得分:0)
benchmark_model使用tensorflow master成功使用以下命令进行编译:
bazel build -c opt --cxxopt='--std=c++11' \
//tensorflow/contrib/lite/tools/benchmark:benchmark_model \
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
--cpu=arm64-v8a --verbose_failures