From c4627039ac217ea1415b43fc07cc98c8e90c1ada Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Tue, 18 Sep 2018 14:25:21 -0700 Subject: Support static dimensions (aka IndexList) in Tensor::resize(...) --- unsupported/Eigen/CXX11/src/Tensor/Tensor.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'unsupported/Eigen/CXX11/src/Tensor/Tensor.h') 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 + EIGEN_DEVICE_FUNC + void resize(const Eigen::IndexList& dimensions) { + array dims; + for (int i = 0; i < NumIndices; ++i) { + dims[i] = static_cast(dimensions[i]); + } + resize(dims); + } +#endif + /** Custom Dimension */ #ifdef EIGEN_HAS_SFINAE template