From 4e0c3df4a40bbb3fce8bbc6f68a885391350af8d Mon Sep 17 00:00:00 2001 From: RachamimYaakobov Date: Fri, 30 Jun 2023 16:16:00 +0300 Subject: [PATCH] Bug fix in KerasObjectLoader.cs I added `ToArray()` so that there is no "The collection has changed" error after `_delete_tracking`. --- src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs b/src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs index 396ad20eb..1e869d666 100644 --- a/src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs +++ b/src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs @@ -174,7 +174,7 @@ public void del_tracking() } if(node is Functional functional) { - foreach(var name in functional.UnconditionalDependencyNames.Keys) + foreach(var name in functional.UnconditionalDependencyNames.Keys.ToArray()) { if(Regex.Match(name, @"^layer(_with_weights)?-[\d+]").Success) {