我正在使用Eigen::Tensor
进行实验,我无法理解为什么最基本的示例失败。为什么这件代码
#include <unsupported/Eigen/CXX11/Tensor>
int main()
{
Eigen::Tensor<int, 2> a(4, 4);
Eigen::Tensor<int, 2> b(4, 4);
a.setRandom();
b.setRandom();
a += b;
return 0;
}
导致错误:
In file included from eigen.cpp:2:
In file included from /usr/local/include/eigen3/unsupported/Eigen/CXX11/Tensor:142:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h:39:7: error: class template partial specialization is not
more specialized than the primary template [-Winvalid-partial-specialization]
class TensorStorage<T, FixedDimensions, Options_>
^
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h:34:63: note: template is declared here
template<typename T, typename Dimensions, int Options_> class TensorStorage;
请更新到默认分支(推荐用于张量模块(,或者至少至3.3分支的头。