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

Function graph_copy_init_tensor

external/ggml/src/ggml-backend.cpp:2041–2066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2039}
2040
2041static void graph_copy_init_tensor(struct ggml_hash_set * hash_set, struct ggml_tensor ** node_copies, bool * node_init, struct ggml_tensor * src) {
2042 size_t id = ggml_hash_find(hash_set, src);
2043 if (node_init[id]) {
2044 return;
2045 }
2046 node_init[id] = true;
2047
2048 struct ggml_tensor * dst = node_copies[id];
2049 if (dst->view_src != NULL) {
2050 graph_copy_init_tensor(hash_set, node_copies, node_init, src->view_src);
2051 enum ggml_status status = ggml_backend_view_init(dst);
2052 GGML_ASSERT(status == GGML_STATUS_SUCCESS);
2053 }
2054 else {
2055 ggml_backend_tensor_copy(src, dst);
2056 }
2057
2058 // init src
2059 for (int i = 0; i < GGML_MAX_SRC; i++) {
2060 struct ggml_tensor * s = src->src[i];
2061 if (s == NULL) {
2062 continue;
2063 }
2064 graph_copy_init_tensor(hash_set, node_copies, node_init, s);
2065 }
2066}
2067
2068struct ggml_backend_graph_copy ggml_backend_graph_copy(ggml_backend_t backend, struct ggml_cgraph * graph) {
2069 GGML_ASSERT(graph);

Callers 1

ggml_backend_graph_copyFunction · 0.85

Calls 3

ggml_hash_findFunction · 0.85
ggml_backend_view_initFunction · 0.85
ggml_backend_tensor_copyFunction · 0.85

Tested by

no test coverage detected