terminate recursive tensor cloning when reaching tensor without src tensors

This commit is contained in:
xaedes 2023-08-14 17:53:36 +02:00
parent 0dd496c5e2
commit 52c92c0a8c
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1

View file

@ -1423,6 +1423,17 @@ struct ggml_tensor * ggml_recompute_graph_node(
return node;
}
int count_children = 0;
for (int k = 0; k < GGML_MAX_SRC; ++k) {
if (node->src[k]) {
++count_children;
}
}
if (count_children == 0) {
return node;
}
size_t i = hash_find(replacements->keys, node);
GGML_ASSERT(i < GGML_GRAPH_HASHTABLE_SIZE); // assert that not full
if (replacements->keys[i] == node) {