| 80 | } |
| 81 | |
| 82 | mx::array next() { |
| 83 | if (idx_ >= x_.shape(0)) { |
| 84 | throw nb::stop_iteration(); |
| 85 | } |
| 86 | |
| 87 | if (idx_ >= 0 && idx_ < splits_.size()) { |
| 88 | return mx::squeeze(splits_[idx_++], 0); |
| 89 | } |
| 90 | |
| 91 | return *(x_.begin() + idx_++); |
| 92 | } |
| 93 | |
| 94 | private: |
| 95 | int idx_; |