| 13 | namespace { |
| 14 | |
| 15 | void write_f32_file(const std::filesystem::path & path, const std::vector<float> & values) { |
| 16 | std::ofstream out(path, std::ios::binary); |
| 17 | if (!out) { |
| 18 | throw std::runtime_error("failed to open output file: " + path.string()); |
| 19 | } |
| 20 | out.write(reinterpret_cast<const char *>(values.data()), static_cast<std::streamsize>(values.size() * sizeof(float))); |
| 21 | if (!out) { |
| 22 | throw std::runtime_error("failed to write output file: " + path.string()); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | void write_i64_file(const std::filesystem::path & path, const std::vector<int64_t> & values) { |
| 27 | std::ofstream out(path, std::ios::binary); |