2017-02-18 5 views
1

[issue#7531] (https://github.com/tensorflow/tensorflow/issues/7531)で要求されているように、非逆双曲線関数(sinhとcosh)を追加してTensorflowコードに貢献しようとしています。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でこれらの2つのテンプレートを追加しました:

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> > {}; 

をしてSINHに置き換え罪への参照またはCoSを持つ非双曲線バージョンの単なるコピーである2つの新しいファイルcwise_op_sinh.cccwise_op_cosh.ccを作っおよびcoshと呼ぶ。私が見る限り、双曲線関数はEigenライブラリの他の数学関数と全く同じように実装されています。しかし、私はエラーを見ることができる限り、それは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"設定を使用することを意味します。これは、 "build:opt --flag1 = value1"などのようなbazelrcファイル内に行があることを前提としています。そうしないと、Bazelは、

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

などの警告を表示する必要があります。

関連する問題