我正在对不受支持的Eigen Tensor库进行一些试验。在文档中,有一个小示例显示如何调整张量对象的大小:
complete: function(){}
当我编译主要由这两行组成的main()时,我从编译器中得到了一堆废话:
Tensor<float, 3> t_3d(2, 3, 4);
t_3d = Tensor<float, 3>(3, 4, 3);
我可以添加一些代码来填充张量,然后打印出内容,一切都会按预期进行:
In file included from /usr/local/include/eigen3/unsupported/Eigen/CXX11/Tensor:88:0,
from tensor_test.cpp:6:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h: In instantiation of ‘struct Eigen::TensorEvaluator<const Eigen::Tensor<float, 3>, Eigen::DefaultDevice>’:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h:96:70: required from ‘struct Eigen::TensorEvaluator<const Eigen::TensorAssignOp<Eigen::Tensor<float, 3>, const Eigen::Tensor<float, 3> >, Eigen::DefaultDevice>’
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h:406:14: required from ‘Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>& Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>::operator=(const Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>&) [with Scalar_ = float; int NumIndices_ = 3; int Options_ = 0; IndexType_ = long int]’
tensor_test.cpp:29:36: required from here
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h:156:71: warning: ignoring attributes on template argument ‘Eigen::PacketType<float, Eigen::DefaultDevice>::type {aka __vector(4) float}’ [-Wignored-attributes]
PacketAccess = (internal::unpacket_traits<PacketReturnType>::size > 1),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h: In instantiation of ‘struct Eigen::TensorEvaluator<Eigen::Tensor<float, 3>, Eigen::DefaultDevice>’:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h:100:65: required from ‘struct Eigen::TensorEvaluator<const Eigen::TensorAssignOp<Eigen::Tensor<float, 3>, const Eigen::Tensor<float, 3> >, Eigen::DefaultDevice>’
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h:406:14: required from ‘Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>& Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>::operator=(const Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>&) [with Scalar_ = float; int NumIndices_ = 3; int Options_ = 0; IndexType_ = long int]’
tensor_test.cpp:29:36: required from here
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h:42:71: warning: ignoring attributes on template argument ‘Eigen::PacketType<float, Eigen::DefaultDevice>::type {aka __vector(4) float}’ [-Wignored-attributes]
PacketAccess = (internal::unpacket_traits<PacketReturnType>::size > 1),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
In file included from /usr/local/include/eigen3/unsupported/Eigen/CXX11/Tensor:121:0,
from tensor_test.cpp:6:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h: In instantiation of ‘static void Eigen::internal::TensorExecutor<Expression, Eigen::DefaultDevice, true>::run(const Expression&, const Eigen::DefaultDevice&) [with Expression = const Eigen::TensorAssignOp<Eigen::Tensor<float, 3>, const Eigen::Tensor<float, 3> >]’:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h:407:65: required from ‘Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>& Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>::operator=(const Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>&) [with Scalar_ = float; int NumIndices_ = 3; int Options_ = 0; IndexType_ = long int]’
tensor_test.cpp:29:36: required from here
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h:61:17: warning: ignoring attributes on template argument ‘Eigen::TensorEvaluator<const Eigen::TensorAssignOp<Eigen::Tensor<float, 3>, const Eigen::Tensor<float, 3> >, Eigen::DefaultDevice>::PacketReturnType {aka __vector(4) float}’ [-Wignored-attributes]
const int PacketSize = unpacket_traits<typename TensorEvaluator<Expression, DefaultDevice>::PacketReturnType>::size;
我想知道是否有人熟悉发出的警告,以及如何解决这些警告?
答案 0 :(得分:1)
我能够使用g ++的unsupported/Eigen/CXX11/src/Tensor
选项关闭来自-isystem
的警告。
我正在使用gcc version 7.4.0
和Eigen version 3.3.7 (323c052e1731)