| 369 | const int64_t count = static_cast<int64_t>(values.size()); |
| 370 | const int64_t chunks = (count + kF32ConvertChunkElements - 1) / kF32ConvertChunkElements; |
| 371 | #pragma omp parallel for schedule(static) |
| 372 | for (int64_t chunk = 0; chunk < chunks; ++chunk) { |
| 373 | const int64_t offset = chunk * kF32ConvertChunkElements; |
| 374 | const int64_t length = std::min(kF32ConvertChunkElements, count - offset); |
| 375 | ggml_fp32_to_bf16_row(values.data() + offset, converted.data() + offset, length); |
| 376 | } |
| 377 | set_tensor_bytes(tensor, converted.data(), converted.size() * sizeof(ggml_bf16_t), name); |
| 378 | if (retained_bytes) { |
| 379 | const auto * begin = reinterpret_cast<const std::byte *>(converted.data()); |
| 380 | retained_bytes->assign(begin, begin + converted.size() * sizeof(ggml_bf16_t)); |
| 381 | } |
no test coverage detected