构建TensorFlow时未宣布的特征函子
Eigen functor undeclared when building Tensorflow
我正在尝试按照[问题#7531]中的要求,通过添加非内双曲线功能(SINH和COSH)来为TensorFlow代码做出贡献。(https://github.com/tensorflow/tensorflow/issues/7531)。
当我用命令测试构建时
$ bazel test --config opt //tensorflow/core/kernels:cwise_ops_test
,但我得到了错误:
> ...
> external/eigen_archive/unsupported/Eigen/CXX11/../../../Eigen/src/Core/MathFunctions.h:1446:3:
> note: 'sinh' should be declared prior to the call site or in an
> associated namespace of one of its arguments T sinh(const T &x) { ^
> 1 error generated. Target //tensorflow/core/kernels:cwise_ops_test
> failed to build Use --verbose_failures to see the command lines of
> failed build steps. INFO: Elapsed time: 6.106s, Critical Path: 5.78s
>
> Executed 0 out of 1 test: 1 fails to build.
可以在这里看到完整的输出。
我所做的就是在cwise_ops.h
中添加这两个模板:
template <typename T>
struct acos : base<T, Eigen::internal::scalar_acos_op<T> > {};
template <typename T>
struct atan : base<T, Eigen::internal::scalar_atan_op<T> > {};
// The following two templates are new:
template <typename T>
struct sinh : base<T, Eigen::internal::scalar_sinh_op<T> > {};
template <typename T>
struct cosh : base<T, Eigen::internal::scalar_cosh_op<T> > {};
并制作了两个新文件cwise_op_sinh.cc
和cwise_op_cosh.cc
,它们仅是非hyperbolic版本的副本,分别用SIN或COS替换为SINH和COSH。据我所知,现在的双曲线功能现在与特征库中的其他数学功能一样实现。但据我所知,它给出了特征源中缺少声明的错误。
这是我的第一个开源贡献,最重要的是,我对C 是相当新的。我做错了什么,可能会有更多的C 经验显而易见。
您是否将`cwise_op_sinh.cc'和'cwise_op_cosh.cc'添加到相应的构建文件中?快速搜索告诉我应该在这里,但我可能错了。不过,您肯定必须告诉Bazel您的新文件。
(这应该是对OP的问题的评论,但我缺乏所需的业力。)
--config opt
标志似乎是错误的,您是指优化构建的-c opt
吗?--config opt
表示使用BAZELRC文件中的" OPT"配置,该配置假定您在BazelRC文件中具有诸如" build:opt -opt -flag1 = value1"的行中的行,并且相似。如果您不这样做,那么Bazel应该显示一个警告说:
WARNING: Config values are not defined in any .rc file: "opt"
或某种效果。
相关文章:
- 如何声明特征矩阵,然后通过嵌套循环初始化它
- 特征::矩阵<双精度,1,3> 结构类型函数中的返回类型函数
- 基于树莓pi的tensorflow lite量化ssd目标检测
- 有没有一种方法可以通过"typedef"为重新定义的基本类型定义特征和强制转换运算符
- 在使用GPU支持编译Tensorflow时,会遇到CUDA_TOOLKIT_PATH未绑定变量
- 特征命名访问向量段
- 将特征矩阵的向量设置为0
- 特征:模板函数中矩阵的平面图
- basic_string的前导/尾部不区分空格的特征
- 特征 3 类的模板专用化
- 特征 c++:复矩阵的面积双曲正切(atanh)
- C++ 中的特征向量计算
- 根据C++标准的定义实现"is_similar"类型特征
- C++类型特征,以查看是否可以<uint32_t>对类型"K"的任何变量调用"static_cast(k)"
- 如何阻止TensorFlow的多线程
- Tensorflow c++ api undefined reference to 'tflite::D efaultErrorReporter()'
- 有没有办法找到特征矩阵系数的中值?
- 在Tensorflow中使用特征的C
- 构建TensorFlow时未宣布的特征函子
- 在 Tensorflow 的 C++ API 中,如何使用特征张量来设置我的 Tensorflow Tensor?