| 700 | if (index_.header_bytes > total || byte_size > total - index_.header_bytes || |
| 701 | info.data_begin > total - index_.header_bytes - byte_size) { |
| 702 | throw std::runtime_error("tensor data range is out of bounds: " + info.name); |
| 703 | } |
| 704 | const size_t data_offset = index_.header_bytes + info.data_begin; |
| 705 | return {bytes_.data() + static_cast<std::ptrdiff_t>(data_offset), byte_size}; |
| 706 | } |
| 707 | |
| 708 | void discard_data_range(const engine::io::SafeTensorInfo & info) const noexcept { |
| 709 | bytes_.discard_range(index_.header_bytes + info.data_begin, info.data_end - info.data_begin); |
| 710 | } |
no outgoing calls