提交 407b0efc 编写于 作者: Q qijun

fix bug in EigenVector::Flatten method

上级 a98346f4
...@@ -65,13 +65,15 @@ template <typename T, int MajorType = Eigen::RowMajor, ...@@ -65,13 +65,15 @@ template <typename T, int MajorType = Eigen::RowMajor,
typename IndexType = Eigen::DenseIndex> typename IndexType = Eigen::DenseIndex>
struct EigenVector : public EigenTensor<T, 1, MajorType, IndexType> { struct EigenVector : public EigenTensor<T, 1, MajorType, IndexType> {
// Flatten is to reshape a Tensor into a one dimension EigenVector // Flatten is to reshape a Tensor into a one dimension EigenVector
static typename EigenTensor<T, 1>::Type Flatten(Tensor& tensor) { static typename EigenTensor<T, 1, MajorType, IndexType>::Type Flatten(
return EigenTensor<T, 1>::From( Tensor& tensor) {
return EigenTensor<T, 1, MajorType, IndexType>::From(
tensor, make_ddim({static_cast<int>(product(tensor.dims_))})); tensor, make_ddim({static_cast<int>(product(tensor.dims_))}));
} }
static typename EigenTensor<T, 1>::ConstType Flatten(const Tensor& tensor) { static typename EigenTensor<T, 1, MajorType, IndexType>::ConstType Flatten(
return EigenTensor<T, 1>::From( const Tensor& tensor) {
return EigenTensor<T, 1, MajorType, IndexType>::From(
tensor, make_ddim({static_cast<int>(product(tensor.dims_))})); tensor, make_ddim({static_cast<int>(product(tensor.dims_))}));
} }
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册