我有张量流二进制文件(已编译)
我已经添加到张量流源:
tensorflow\core\user_ops\icp_op_kernel.cc
-包含:
https://github.com/tensorflow/models/blob/master/research/vid2depth/ops/icp_op_kernel.cc
tensorflow\core\user_ops\BUILD
-包含:
load("//tensorflow:tensorflow.bzl", "tf_custom_op_library")
tf_custom_op_library(
name = "icp_op_kernel.so",
srcs = ["icp_op_kernel.cc"],
)
我正在尝试使用:
bazel build --config opt //tensorflow/core/user_ops:icp_op_kernel.so
我得到:
tensorflow/core/user_ops/icp_op_kernel.cc(16): fatal error C1083: Cannot open include file: 'pcl/point_types.h': No such file or directory
因为bazel不知道pcl包含文件在哪里。 我已经安装了pcl,并且include目录位于:
C:\Program Files\PCL 1.6.0\include\pcl-1.6
如何告诉bazel也包含此目录?
我可能还需要在链接中添加C:\Program Files\PCL 1.6.0\lib
,我该怎么做?
答案 0 :(得分:1)
如果操作失败,则不需要Object.values
。
我已经在CPU和GPU中实现了自定义操作,并且基本上遵循了两个Tensorflow教程。
对于CPU操作,请遵循Build the op library上的Tensorflow教程:
<!-- EM CONSTRUÇÃO -->
<header>
<nav class="navbar navbar-expand navbar-light bg-lilas-2 fixed-top <%= informations.checking.has.ShopkeeperComparePage ? 'shadow' : null; %>">
<div class="container-fluid d-flex justify-content-between">
<div>
<% if(informations.checking.has.HomePage) { %>
<button type="button" class="btn btn-default bg-transparent shadow-none" data-toggle="modal" data-target="#filter"><i class="menu-options-icon text-lilas-1"></i></button>
<% } else if(informations.checking.has.ShoppingPage) { %>
<button onClick="document.location.replace('/home/v1/query?Shop=<%= informations.HTTP.querys.Shop %>&PeriodOf=<%= informations.HTTP.querys.PeriodOf %>&PeriodUntil=<%= informations.HTTP.querys.PeriodUntil %>&PeriodType=<%= informations.HTTP.querys.PeriodType %>&Indicator=<%= informations.HTTP.querys.Indicator %>')" type="button" class="btn btn-lg bg-transparent shadow-none"><i class="back-arrow-icon text-lilas-1"></i></button>
<% } else if(informations.checking.has.ShopkeeperPage) { %>
<button onClick="document.location.replace('/shopping/v1/query?Shop=<%= informations.HTTP.querys.Shop %>&PeriodOf=<%= informations.HTTP.querys.PeriodOf %>&PeriodUntil=<%= informations.HTTP.querys.PeriodUntil %>&PeriodType=<%= informations.HTTP.querys.PeriodType %>&Indicator=<%= informations.HTTP.querys.Indicator %>')" type="button" class="btn btn-lg bg-transparent shadow-none"><i class="back-arrow-icon text-lilas-1"></i></button>
<% } else if(informations.checking.has.ShopkeeperDetailsPage) { %>
<button onClick="document.location.replace('/lojista/v1/query?Shop=<%= informations.HTTP.querys.Shop %>&PeriodOf=<%= informations.HTTP.querys.PeriodOf %>&PeriodUntil=<%= informations.HTTP.querys.PeriodUntil %>&PeriodType=<%= informations.HTTP.querys.PeriodType %>&Indicator=<%= informations.HTTP.querys.Indicator %>')" type="button" class="btn btn-lg bg-transparent shadow-none"><i class="back-arrow-icon text-lilas-1"></i></button>
<% } else if(informations.checking.has.ShopkeeperComparePage) { %>
<button onClick="document.location.replace('/lojistadetalhes/v1/query?Shop=<%= informations.HTTP.querys.Shop %>&PeriodOf=<%= informations.HTTP.querys.PeriodOf %>&PeriodUntil=<%= informations.HTTP.querys.PeriodUntil %>&PeriodType=<%= informations.HTTP.querys.PeriodType %>&Indicator=<%= informations.HTTP.querys.Indicator %>')" type="button" class="btn btn-lg bg-transparent shadow-none"><i class="back-arrow-icon text-lilas-1"></i></button>
<% } %>
</div>
<div class="flex-fill text-center ml-4 pl-sm-2">
<span class="navbar-brand text-white"><%= informations.page.general.titles.navbar %></span>
</div>
<div>
<% if(informations.checking.has.ShopkeeperDetailsPage) { %>
<button onClick="(document.getElementById('BTNSWI').getAttribute('data-indicator') === 'm²') ? document.location.replace('/<%= informations.page.general.type %>/v1/query?Shop=<%= informations.HTTP.querys.Shop %>&Storename=<%= informations.HTTP.querys.Storename %>&PeriodOf=<%= informations.HTTP.querys.PeriodOf %>&PeriodUntil=<%= informations.HTTP.querys.PeriodUntil %>&PeriodType=<%= informations.HTTP.querys.PeriodType %>&Indicator=M2') : document.location.replace('/<%= informations.page.general.type %>/v1/query?Shop=<%= informations.HTTP.querys.Shop %>&Storename=<%= informations.HTTP.querys.Storename %>&PeriodOf=<%= informations.HTTP.querys.PeriodOf %>&PeriodUntil=<%= informations.HTTP.querys.PeriodUntil %>&PeriodType=<%= informations.HTTP.querys.PeriodType %>&Indicator=ABS');" type="button" id="BTNSWI" class="btn btn-sm btn-switch-indicator shadow-none" data-toggle="button" data-indicator="<%= (informations.page.data.API.indicatorType === 'm²') ? 'abs' : 'm²' %>" aria-pressed="false" autocomplete="off">
<div id="teste" class="handle-switch-indicator"></div>
</button>
<% } else { %>
<button onClick="(document.getElementById('BTNSWI').getAttribute('data-indicator') === 'm²') ? document.location.replace('/<%= informations.page.general.type %>/v1/query?Shop=<%= informations.HTTP.querys.Shop %>&PeriodOf=<%= informations.HTTP.querys.PeriodOf %>&PeriodUntil=<%= informations.HTTP.querys.PeriodUntil %>&PeriodType=<%= informations.HTTP.querys.PeriodType %>&Indicator=M2') : document.location.replace('/<%= informations.page.general.type %>/v1/query?Shop=<%= informations.HTTP.querys.Shop %>&PeriodOf=<%= informations.HTTP.querys.PeriodOf %>&PeriodUntil=<%= informations.HTTP.querys.PeriodUntil %>&PeriodType=<%= informations.HTTP.querys.PeriodType %>&Indicator=ABS');" type="button" id="BTNSWI" class="btn btn-sm btn-switch-indicator shadow-none" data-toggle="button" data-indicator="<%= (informations.page.data.API.indicatorType === 'm²') ? 'abs' : 'm²' %>" aria-pressed="false" autocomplete="off">
<div id="teste" class="handle-switch-indicator"></div>
</button>
<% } %>
</div>
</div>
</nav>
</header>
关于bazel
版本TF_CFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
TF_LFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') )
g++ -std=c++11 -shared zero_out.cc -o zero_out.so -fPIC ${TF_CFLAGS[@]} ${TF_LFLAGS[@]} -O2
的注释:gcc从版本5开始使用新的gcc
。TensorFlow网站上可用的二进制pip包是使用旧版ABI的gcc4构建的。如果您使用>=5
编译操作库,请将C++ ABI
添加到命令行以使该库与较早的abi兼容。
对于GPU操作,请查看Tensorflow adding GPU op support上当前的官方GPU操作构建说明
gcc>=5
如前所述,请注意,如果您的CUDA库未安装在-D_GLIBCXX_USE_CXX11_ABI=0
中,则需要在上面的第二个(g ++)命令中显式指定路径。例如,如果您的CUDA已安装在nvcc -std=c++11 -c -o cuda_op_kernel.cu.o cuda_op_kernel.cu.cc \
${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
g++ -std=c++11 -shared -o cuda_op_kernel.so cuda_op_kernel.cc \
cuda_op_kernel.cu.o ${TF_CFLAGS[@]} -fPIC -lcudart ${TF_LFLAGS[@]}
中,则添加/usr/local/lib64
。
此外,请注意,在某些Linux设置中,需要nvcc编译步骤的其他选项。将-L /usr/local/cuda-8.0/lib64/
添加到nvcc命令行中,以避免来自/usr/local/cuda-8.0
的错误。