【问题标题】:Eigen Tensor compilation error特征张量编译错误
【发布时间】:2018-04-03 17:25:24
【问题描述】:

我正在尝试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;

【问题讨论】:

  • 似乎 compile fine 使用任何最新版本的 Eigen。
  • 我已经在 Homebrew (3.3.4) 和 Ubuntu 17.10 (也是 3.3.4) 附带的版本上进行了测试。

标签: c++ eigen tensor


【解决方案1】:

请更新到默认分支(推荐用于 Tensor 模块),或者至少更新到 3.3 分支的头部。

【讨论】:

  • 我使用 Homebrew 自带的 3.3.4。那还不够吗?
  • 3.3.5 就可以了。
猜你喜欢
  • 1970-01-01
  • 2021-11-01
  • 2018-09-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多