2017-02-18 78 views
1

我試圖通過添加非反雙曲線函數(sinh和cosh),如[問題#7531] (https://github.com/tensorflow/tensorflow/issues/7531)中所請求貢獻Tensorflow代碼。Eigen functor未建立時建立Tensorflow

當我測試構建與命令

$ 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. 

完整的輸出可以看出here

我所做的是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.cccwise_op_cosh.cc,這只是與SINH取代非雙曲版本,引用正弦或餘弦的副本和cosh。據我所知,雙曲函數現在可以像Eigen庫中的其他數學函數一樣實現。但據我看到的錯誤,它提供了在特徵源中缺少聲明的引用。

這是我第一次開源貢獻,最重要的是我對C++相當陌生。更多的C++經驗讓我做錯了很明顯。

回答

0

您是否將`cwise_op_sinh.cc'和'cwise_op_cosh.cc'添加到相應的BUILD文件中?快速搜索告訴我它應該是here,但我可能是錯的。儘管如此,你一定要告訴Bazel你的新文件。

1

這應該是OP的問題進行評論,但我缺少必要的因果報應。

--config opt標誌似乎是錯誤的,你的意思是-c opt優化構建? --config opt表示使用bazelrc文件中的「opt」配置,該文件假定您在bazelrc文件中具有諸如「build:opt --flag1 = value1」等類似的行。如果你不這樣做,那麼Bazel應該會顯示一條警告:

WARNING: Config values are not defined in any .rc file: "opt" 

或者這個效果。