| 72 | } |
| 73 | |
| 74 | size_t tensor_buffer_size(mio::circle::Reader &reader, const int32_t tensor_id) |
| 75 | { |
| 76 | auto tensors = reader.tensors(); |
| 77 | |
| 78 | if (tensor_id < 0 || tensor_id >= tensors->size()) |
| 79 | { |
| 80 | throw std::runtime_error("Invalid Tensor ID"); |
| 81 | } |
| 82 | |
| 83 | auto tensor = tensors->Get(tensor_id); |
| 84 | auto buffer_id = tensor->buffer(); |
| 85 | bool ext_offset = false; |
| 86 | |
| 87 | size_t size = reader.buffer_info(buffer_id, nullptr, ext_offset); |
| 88 | |
| 89 | return size; |
| 90 | } |
| 91 | |
| 92 | } // namespace |
| 93 |