| 16383 | } |
| 16384 | |
| 16385 | struct ggml_cgraph * ggml_graph_view(struct ggml_context * ctx, struct ggml_cgraph * cgraph0, int i0, int i1) { |
| 16386 | const size_t obj_size = sizeof(struct ggml_cgraph); |
| 16387 | struct ggml_object * obj = ggml_new_object(ctx, GGML_OBJECT_GRAPH, obj_size); |
| 16388 | struct ggml_cgraph * cgraph = (struct ggml_cgraph *) ((char *) ctx->mem_buffer + obj->offs); |
| 16389 | |
| 16390 | *cgraph = (struct ggml_cgraph) { |
| 16391 | /*.size =*/ 0, |
| 16392 | /*.n_nodes =*/ i1 - i0, |
| 16393 | /*.n_leafs =*/ 0, |
| 16394 | /*.nodes =*/ cgraph0->nodes + i0, |
| 16395 | /*.grads =*/ cgraph0->grads ? cgraph0->grads + i0 : NULL, |
| 16396 | /*.leafs =*/ NULL, |
| 16397 | /*.hash_table =*/ { 0, NULL }, |
| 16398 | /*.order =*/ cgraph0->order, |
| 16399 | /*.perf_runs =*/ 0, |
| 16400 | /*.perf_cycles =*/ 0, |
| 16401 | /*.perf_time_us =*/ 0, |
| 16402 | }; |
| 16403 | |
| 16404 | return cgraph; |
| 16405 | } |
| 16406 | |
| 16407 | void ggml_graph_cpy(struct ggml_cgraph * src, struct ggml_cgraph * dst) { |
| 16408 | GGML_ASSERT(dst->size >= src->n_leafs); |
no test coverage detected