| 18209 | } |
| 18210 | |
| 18211 | static void ggml_opt_get_params(int np, struct ggml_tensor * const ps[], float * x) { |
| 18212 | int i = 0; |
| 18213 | for (int p = 0; p < np; ++p) { |
| 18214 | const int64_t ne = ggml_nelements(ps[p]) ; |
| 18215 | // TODO: add function to get all elements at once |
| 18216 | for (int64_t j = 0; j < ne; ++j) { |
| 18217 | x[i++] = ggml_get_f32_1d(ps[p], j); |
| 18218 | } |
| 18219 | } |
| 18220 | } |
| 18221 | |
| 18222 | static void ggml_opt_get_grad(int np, struct ggml_tensor * const ps[], float * g) { |
| 18223 | int64_t i = 0; |
no test coverage detected