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

Function build_graph

external/ggml/tests/test-conv-transpose-1d.cpp:279–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279struct ggml_cgraph * build_graph(const test_model& model) {
280 static size_t buf_size = ggml_tensor_overhead()*GGML_DEFAULT_GRAPH_SIZE + ggml_graph_overhead();
281 static std::vector<uint8_t> buf(buf_size);
282
283 struct ggml_init_params params0 = {
284 /*.mem_size =*/ buf_size,
285 /*.mem_buffer =*/ buf.data(),
286 /*.no_alloc =*/ true, // the tensors will be allocated later by ggml_gallocr_alloc_graph()
287 };
288
289 // create a temporally context to build the graph
290 struct ggml_context * ctx0 = ggml_init(params0);
291
292 struct ggml_cgraph * gf = ggml_new_graph(ctx0);
293
294 int s0 = 1;
295 int p0 = 0;
296 int d0 = 1;
297
298 struct ggml_tensor* conv1d_transpose_res_0 = ggml_conv_transpose_1d(ctx0, model.a_0, model.b_0, s0, p0, d0);
299 ggml_set_name(conv1d_transpose_res_0, "conv1d_transpose_res_0");
300 ggml_build_forward_expand(gf, conv1d_transpose_res_0);
301
302
303 s0 = 1;
304 p0 = 0;
305 d0 = 1;
306
307 struct ggml_tensor* conv1d_transpose_res_1 = ggml_conv_transpose_1d(ctx0, model.a_1, model.b_1, s0, p0, d0);
308 ggml_set_name(conv1d_transpose_res_1, "conv1d_transpose_res_1");
309 ggml_build_forward_expand(gf, conv1d_transpose_res_1);
310
311 s0 = 1;
312 p0 = 0;
313 d0 = 1;
314
315 struct ggml_tensor* conv1d_transpose_res_2 = ggml_conv_transpose_1d(ctx0, model.a_2, model.b_2, s0, p0, d0);
316 ggml_set_name(conv1d_transpose_res_2, "conv1d_transpose_res_2");
317 ggml_build_forward_expand(gf, conv1d_transpose_res_2);
318
319 s0 = 2;
320 p0 = 0;
321 d0 = 1;
322
323 struct ggml_tensor* conv1d_transpose_res_3 = ggml_conv_transpose_1d(ctx0, model.a_2, model.b_2, s0, p0, d0);
324 ggml_set_name(conv1d_transpose_res_3, "conv1d_transpose_res_3");
325 ggml_build_forward_expand(gf, conv1d_transpose_res_3);
326
327 s0 = 1;
328 p0 = 0;
329 d0 = 1;
330
331 struct ggml_tensor* conv1d_transpose_res_4 = ggml_conv_transpose_1d(ctx0, model.a_3, model.b_3, s0, p0, d0);
332 ggml_set_name(conv1d_transpose_res_4, "conv1d_transpose_res_4");
333 ggml_build_forward_expand(gf, conv1d_transpose_res_4);
334
335 s0 = 2;
336 p0 = 0;

Callers 2

compute_graphFunction · 0.70
mainFunction · 0.70

Calls 9

ggml_tensor_overheadFunction · 0.85
ggml_graph_overheadFunction · 0.85
ggml_initFunction · 0.85
ggml_new_graphFunction · 0.85
ggml_conv_transpose_1dFunction · 0.85
ggml_set_nameFunction · 0.85
ggml_freeFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected