From cfddc36be220a035ceaab4bb7365b399cc0cf700 Mon Sep 17 00:00:00 2001 From: xaedes Date: Mon, 14 Aug 2023 17:52:15 +0200 Subject: [PATCH] correctly clone reshape and permute operations by also cloning tensor->nb values --- examples/train-text-from-scratch/train-text-from-scratch.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/train-text-from-scratch/train-text-from-scratch.cpp b/examples/train-text-from-scratch/train-text-from-scratch.cpp index 03ec39d86..92e6315dc 100644 --- a/examples/train-text-from-scratch/train-text-from-scratch.cpp +++ b/examples/train-text-from-scratch/train-text-from-scratch.cpp @@ -1440,6 +1440,9 @@ struct ggml_tensor * ggml_recompute_graph_node( clone->grad = node->grad; clone->is_param = node->is_param; clone->extra = node->extra; + for (int k = 0; k < GGML_MAX_DIMS; ++k) { + clone->nb[k] = node->nb[k]; + } for (int k = 0; k < GGML_MAX_SRC; ++k) { clone->src[k] = ggml_recompute_graph_node(ctx, graph, replacements, node->src[k]); }