| 527 | |
| 528 | template <int NDIMS, typename IndexType> |
| 529 | Eigen::DSizes<IndexType, NDIMS> TensorShape::AsEigenDSizesWithPadding() const { |
| 530 | CheckDimsAtLeast(NDIMS); |
| 531 | static_assert(NDIMS <= TensorShape::MaxDimensions(), "Too many dimensions"); |
| 532 | Eigen::DSizes<IndexType, NDIMS> dsizes; |
| 533 | for (int d = 0; d < dims(); d++) { |
| 534 | dsizes[d] = static_cast<IndexType>(dim_size(d)); |
| 535 | } |
| 536 | for (int d = dims(); d < NDIMS; d++) { |
| 537 | dsizes[d] = 1; |
| 538 | } |
| 539 | return dsizes; |
| 540 | } |
| 541 | |
| 542 | // ---------------------------------------------------------------------------- |
| 543 | // Inlining of some performance critical routines |