[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.cc
とcwise_op_cosh.cc
を作っおよびcoshと呼ぶ。私が見る限り、双曲線関数はEigenライブラリの他の数学関数と全く同じように実装されています。しかし、私はエラーを見ることができる限り、それはEigenソース内の欠落している宣言への参照を与えます。
これは私の最初のオープンソースの貢献であり、その上に私はC++をかなり新しくしています。私が間違っていたのは、C++の経験が多いほど明白かもしれません。