TensorFlow.NET
TensorFlow.NET copied to clipboard
Breadth-first traversal of augmented graph view causes collection modification exception
Description
Calling breadth_first_traversal on the AugmentedGraphView as done by the save method causes a "collection was modified; enumeration operation may not execute" exception because it's setting values on _children_cache[key].
Specifically:
` public class AugmentedGraphView: ObjectGraphView
//...
// around line 89
public override (IList
// could we change this to // void get_merged_trackable(Trackable x)
Trackable get_merged_trackable(Trackable x)
{
// TODO: complete it with new definitions `Asset` and `TrackableConstant`.
return x;
}
var trackable_objects = base.breadth_first_traversal();
foreach(var obj in _children_cache.Keys)
{
// skip the deletion of cache (maybe do it later).
foreach(var pair in _children_cache[obj])
{
// could we change this to // get_merged_trackable(pair.Value);
_children_cache[obj][pair.Key] = get_merged_trackable(pair.Value);
}
}
return base.breadth_first_traversal();
}`
Reproduction Steps
Call breadth_first_traversal on an AugmentedGraphView
Known Workarounds
None yet
Configuration and Other Information
This appears to be present in commit 197224f, and TF.NET 0.150.0.