Skip to content

Error when saving model using model.save #1246

Open
@le-tan-phuc

Description

@le-tan-phuc

Description

Hi, I'm new to Tensorflow.net. I'm just playing around with the "Toy version of ResNet in Keras" example on the main page and got an error at the model.save("./toy_resnet_model");

C# threw an exception: System.InvalidOperationException: 'Collection was modified; enumeration operation may not execute.'

I tried to debug and trace the problem and it seems like the exception was thrown at some point within this function:

(MetaGraphDef, Graph, TrackableSaver, AssetInfo, IList<Trackable>, IDictionary<Trackable, IEnumerable<TrackableReference>>) tuple = _build_meta_graph(obj, signatures, options, metaGraphDef);

which is part of

(saved_nodes, node_paths) = SavedModelUtils.save_and_return_nodes(model, filepath, signatures, options);

which is part of

KerasSavedModelUtils.save_model(this, filepath, overwrite, include_optimizer, signatures, options, save_traces);

Package installed:

  • TensorFlow.NET 0.150.0
  • TensorFlow.Keras 0.15.0
  • SciSharp.TensorFlow.Redist 2.16.0

Any help would be appreciated! Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions