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) {