initialize the tensors of the model in this case two matrices 2x2
| 53 | |
| 54 | // initialize the tensors of the model in this case two matrices 2x2 |
| 55 | void init_model(simple_model & model) { |
| 56 | ggml_log_set(ggml_log_callback_default, nullptr); |
| 57 | |
| 58 | ggml_backend_load_all(); |
| 59 | |
| 60 | model.backend = ggml_backend_init_best(); |
| 61 | model.cpu_backend = ggml_backend_init_by_type(GGML_BACKEND_DEVICE_TYPE_CPU, nullptr); |
| 62 | |
| 63 | ggml_backend_t backends[2] = { model.backend, model.cpu_backend }; |
| 64 | model.sched = ggml_backend_sched_new(backends, nullptr, 2, GGML_DEFAULT_GRAPH_SIZE, false, true); |
| 65 | } |
| 66 | |
| 67 | // build the compute graph to perform a matrix multiplication |
| 68 | struct ggml_cgraph * build_graph(simple_model& model) { |
no test coverage detected