| 305 | } |
| 306 | |
| 307 | if (type == GGML_TYPE_F16) { |
| 308 | std::vector<ggml_fp16_t> converted(values.size()); |
| 309 | const int64_t count = static_cast<int64_t>(values.size()); |
| 310 | const int64_t chunks = (count + kF32ConvertChunkElements - 1) / kF32ConvertChunkElements; |
| 311 | #pragma omp parallel for schedule(static) |
| 312 | for (int64_t chunk = 0; chunk < chunks; ++chunk) { |
| 313 | const int64_t offset = chunk * kF32ConvertChunkElements; |
| 314 | const int64_t length = std::min(kF32ConvertChunkElements, count - offset); |
| 315 | ggml_fp32_to_fp16_row(values.data() + offset, converted.data() + offset, length); |
| 316 | } |
| 317 | set_tensor_bytes(tensor, converted.data(), converted.size() * sizeof(ggml_fp16_t), name); |
| 318 | return; |
| 319 | } |
| 320 |
no test coverage detected