diff options
author | Eugene Zhulenev <ezhulenev@google.com> | 2018-09-18 14:25:21 -0700 |
---|---|---|
committer | Eugene Zhulenev <ezhulenev@google.com> | 2018-09-18 14:25:21 -0700 |
commit | c4627039ac217ea1415b43fc07cc98c8e90c1ada (patch) | |
tree | 4602ca7ac1f9709e7cd06e378ea7e56015b97923 /unsupported/Eigen/CXX11 | |
parent | 218a7b98401aee558b96e21d8ba90641eb3e9371 (diff) |
Support static dimensions (aka IndexList) in Tensor::resize(...)
Diffstat (limited to 'unsupported/Eigen/CXX11')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/Tensor.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h index aed71b265..95349d0ed 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h @@ -477,6 +477,18 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp // Nothing to do: rank 0 tensors have fixed size } +#ifdef EIGEN_HAS_INDEX_LIST + template <typename FirstType, typename... OtherTypes> + EIGEN_DEVICE_FUNC + void resize(const Eigen::IndexList<FirstType, OtherTypes...>& dimensions) { + array<Index, NumIndices> dims; + for (int i = 0; i < NumIndices; ++i) { + dims[i] = static_cast<Index>(dimensions[i]); + } + resize(dims); + } +#endif + /** Custom Dimension */ #ifdef EIGEN_HAS_SFINAE template<typename CustomDimension, |