| 626 | } |
| 627 | |
| 628 | shape shape::to_static(std::size_t x) const |
| 629 | { |
| 630 | if(not sub_shapes().empty()) |
| 631 | { |
| 632 | std::vector<shape> subs; |
| 633 | std::transform(sub_shapes().cbegin(), |
| 634 | sub_shapes().cend(), |
| 635 | std::back_inserter(subs), |
| 636 | [&](auto s) { return s.to_static(x); }); |
| 637 | return shape(subs); |
| 638 | } |
| 639 | if(not this->dynamic()) |
| 640 | { |
| 641 | return *this; |
| 642 | } |
| 643 | auto static_lens = this->max_lens(); |
| 644 | std::transform(static_lens.begin(), |
| 645 | static_lens.end(), |
| 646 | this->dyn_dims().cbegin(), |
| 647 | static_lens.begin(), |
| 648 | [&](auto sl, const auto& dd) { return dd.is_fixed() ? sl : x; }); |
| 649 | return {type(), static_lens}; |
| 650 | } |
| 651 | |
| 652 | std::size_t shape::element_space() const { return impl->element_space(); } |
| 653 | |