| 558 | } |
| 559 | |
| 560 | inline uint64_t volume() const |
| 561 | { |
| 562 | if (is_dynamic()) { |
| 563 | auto s = shape()[0]; |
| 564 | uint64_t v = 0; |
| 565 | for (int64_t i = 0L; i < s; ++i) { |
| 566 | v += operator[](i).volume(); |
| 567 | } |
| 568 | return v; |
| 569 | } |
| 570 | if (has_data_) { |
| 571 | return data().size() / nd::dtype_bytes(dtype_); |
| 572 | } |
| 573 | auto sh = shape(); |
| 574 | return std::accumulate(sh.begin(), sh.end(), 1L, std::multiplies<uint64_t>()); |
| 575 | } |
| 576 | |
| 577 | template <typename T> |
| 578 | inline T value(int64_t index) const |
no test coverage detected