From f4e9ce79989e8fc62310ca33919346cd0ec79a07 Mon Sep 17 00:00:00 2001 From: xaedes Date: Sat, 20 May 2023 14:49:19 +0200 Subject: [PATCH] enable gradient propagation for inplace add1 and scale operations those functions backward passes don't need the original src0, so they also work when forward is inplace --- ggml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ggml.c b/ggml.c index 7039a3cec..7b66846ee 100644 --- a/ggml.c +++ b/ggml.c @@ -4374,7 +4374,7 @@ struct ggml_tensor * ggml_add1_impl( bool is_node = false; - if (!inplace && (a->grad || b->grad)) { + if (a->grad || b->grad) { is_node = true; } @@ -5205,7 +5205,7 @@ struct ggml_tensor * ggml_scale_impl( bool is_node = false; - if (!inplace && (a->grad || b->grad)) { + if (a->grad || b->grad) { is_node = true; }