Closed Copot777 closed 11 months ago
I'm sorry, because there are cells in the LSTM, the performance of the load_model is not quite the same as other models, so the load of the LSTM model has not been completed yet.
Hello, this bug has been resolved and has been merged into the master branch.
Description
keras.models.load_model(...) throws
Tensorflow.ValueError: The tensor input_1:0 at layer l_s_t_m is part of a cycle. at Tensorflow.Keras.Engine.Functional.BuildMapHelper(Tensor tensor, List
1 finished_nodes, List
1 nodes_in_progress, List1 nodes_in_decreasing_depth, Dictionary
2 layer_indices) at Tensorflow.Keras.Engine.Functional.BuildMapHelper(Tensor tensor, List1 finished_nodes, List
1 nodes_in_progress, List1 nodes_in_decreasing_depth, Dictionary
2 layer_indices) at Tensorflow.Keras.Engine.Functional.BuildMap(Tensors outputs) at Tensorflow.Keras.Engine.Functional.MapGraphNetwork(Tensors inputs, Tensors outputs) at Tensorflow.Keras.Engine.Functional._init_graph_network(Tensors inputs, Tensors outputs) at Tensorflow.Keras.Engine.Sequential.add(ILayer layer) at Tensorflow.Keras.Engine.Sequential.InitLayers(IEnumerable1 layers) at Tensorflow.Keras.Saving.KerasObjectLoader._reconstruct_model(Int32 model_id, Model model, List
1 layers) at Tensorflow.Keras.Saving.KerasObjectLoader._reconstruct_all_models() at Tensorflow.Keras.Saving.KerasObjectLoader.finalize_objects() at Tensorflow.Keras.Saving.SavedModel.KerasLoadModelUtils.load(String path, Boolean compile, LoadOptions options) at Tensorflow.Keras.Saving.SavedModel.KerasLoadModelUtils.load_model(String filepath, IDictionary`2 custom_objects, Boolean compile, LoadOptions options) at Tensorflow.Keras.Models.ModelsApi.load_model(String filepath, Boolean compile, LoadOptions options)Reproduction Steps
This is a code fragment reproducing the issue.
var inputs = tf.random.normal(shape: (10, 5, 3));
var outputs = tf.random.normal(shape: (10, 1));
var model = keras.Sequential();
Known Workarounds
None I can find so far. But Model.LoadModel(...) with LSTM from Keras.NET works fine
Configuration and Other Information
.NET 6.0 TensorFlow.NET 0.110.0 TensoFlow.Keras 0.11.0 SciSharp.TensorFlow.Redist CPU 2.14.0