MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / init_model

Function init_model

external/ggml/examples/simple/simple-backend.cpp:55–65  ·  view source on GitHub ↗

initialize the tensors of the model in this case two matrices 2x2

Source from the content-addressed store, hash-verified

53
54// initialize the tensors of the model in this case two matrices 2x2
55void 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
68struct ggml_cgraph * build_graph(simple_model& model) {

Callers 1

mainFunction · 0.85

Calls 5

ggml_log_setFunction · 0.85
ggml_backend_load_allFunction · 0.85
ggml_backend_init_bestFunction · 0.85
ggml_backend_sched_newFunction · 0.85

Tested by

no test coverage detected