mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Support static dimensions (aka IndexList) in Tensor::resize(...)
This commit is contained in:
parent
218a7b9840
commit
c4627039ac
@ -477,6 +477,18 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp
|
|||||||
// Nothing to do: rank 0 tensors have fixed size
|
// 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 */
|
/** Custom Dimension */
|
||||||
#ifdef EIGEN_HAS_SFINAE
|
#ifdef EIGEN_HAS_SFINAE
|
||||||
template<typename CustomDimension,
|
template<typename CustomDimension,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user