diff --git a/src/TensorFlowNET.Core/Keras/IInitializersApi.cs b/src/TensorFlowNET.Core/Keras/IInitializersApi.cs index ff92040e..3ad5e87b 100644 --- a/src/TensorFlowNET.Core/Keras/IInitializersApi.cs +++ b/src/TensorFlowNET.Core/Keras/IInitializersApi.cs @@ -7,5 +7,7 @@ namespace Tensorflow.Keras public interface IInitializersApi { IInitializer Orthogonal(float gain = 1.0f, int? seed = null); + + IInitializer HeNormal(int? seed = null); } } diff --git a/src/TensorFlowNET.Core/Tensorflow.Binding.csproj b/src/TensorFlowNET.Core/Tensorflow.Binding.csproj index 0ebe61d0..4c42cb8c 100644 --- a/src/TensorFlowNET.Core/Tensorflow.Binding.csproj +++ b/src/TensorFlowNET.Core/Tensorflow.Binding.csproj @@ -1,11 +1,11 @@  - netstandard2.0 + netstandard2.0;net6.0 Tensorflow.Binding Tensorflow - 2.2.0 - 0.100.0 + 2.10.0 + 0.100.1 10.0 enable Haiping Chen, Meinrad Recheis, Eli Belash @@ -20,7 +20,7 @@ Google's TensorFlow full binding in .NET Standard. Building, training and infering deep learning models. https://tensorflownet.readthedocs.io - 0.100.0.0 + 0.100.1.0 tf.net 0.100.x and above are based on tensorflow native 2.10.0 @@ -38,7 +38,7 @@ https://tensorflownet.readthedocs.io tf.net 0.7x.x aligns with TensorFlow v2.7.x native library. tf.net 0.10x.x aligns with TensorFlow v2.10.x native library. - 0.100.0.0 + 0.100.1.0 LICENSE true true @@ -108,7 +108,7 @@ https://tensorflownet.readthedocs.io - + diff --git a/src/TensorFlowNET.Keras/Engine/Functional.cs b/src/TensorFlowNET.Keras/Engine/Functional.cs index d10ed214..09a31b94 100644 --- a/src/TensorFlowNET.Keras/Engine/Functional.cs +++ b/src/TensorFlowNET.Keras/Engine/Functional.cs @@ -65,12 +65,7 @@ namespace Tensorflow.Keras.Engine } // Keep track of the network's nodes and layers. - (NetworkNodes, NodesByDepth, var layers, _) = MapGraphNetwork(inputs, outputs); - - if (!_self_tracked_trackables.Any()) - { - _self_tracked_trackables = layers; - } + (NetworkNodes, NodesByDepth, _self_tracked_trackables, _) = MapGraphNetwork(inputs, outputs); // Build self.input_names and self.output_names. _set_output_names(); diff --git a/src/TensorFlowNET.Keras/Engine/Sequential.cs b/src/TensorFlowNET.Keras/Engine/Sequential.cs index b4d1ecfe..4d87659b 100644 --- a/src/TensorFlowNET.Keras/Engine/Sequential.cs +++ b/src/TensorFlowNET.Keras/Engine/Sequential.cs @@ -110,6 +110,8 @@ namespace Tensorflow.Keras.Engine } else if (outputs != null) { + // If the model is being built continuously on top of an input layer: + // refresh its output. outputs = layer.Apply(outputs); built = true; } @@ -155,7 +157,7 @@ namespace Tensorflow.Keras.Engine Tensors layer_output = null; Tensors outputs = null; List created_nodes = new List(); - foreach (var layer in _self_tracked_trackables) + foreach (var layer in args.Layers) { clear_previously_created_nodes(layer, _created_nodes); layer_output = layer.Apply(layer_input); diff --git a/src/TensorFlowNET.Keras/InitializersApi.cs b/src/TensorFlowNET.Keras/InitializersApi.cs index d37ccd99..6bade172 100644 --- a/src/TensorFlowNET.Keras/InitializersApi.cs +++ b/src/TensorFlowNET.Keras/InitializersApi.cs @@ -25,7 +25,7 @@ public partial class InitializersApi : IInitializersApi /// /// /// - public IInitializer he_normal(int? seed = null) + public IInitializer HeNormal(int? seed = null) { return new VarianceScaling(factor: 2.0f, mode: "fan_in", seed: seed); } diff --git a/src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs b/src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs index f894f41f..877c3599 100644 --- a/src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs +++ b/src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs @@ -45,6 +45,11 @@ namespace Tensorflow.Keras.Layers.Rnn } } + protected override Tensors Call(Tensors inputs, Tensor state = null, bool? training = null) + { + return base.Call(inputs, state, training); + } + private static RNNArgs PreConstruct(RNNArgs args) { if (args.Kwargs == null) diff --git a/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs b/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs index 8d696d16..9e5af450 100644 --- a/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs +++ b/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs @@ -33,11 +33,16 @@ namespace Tensorflow.Keras.Layers.Rnn if (args.UseBias) { bias = add_weight("bias", (args.Units), - initializer: args.RecurrentInitializer + initializer: args.BiasInitializer ); } built = true; } + + protected override Tensors Call(Tensors inputs, Tensor state = null, bool? training = null) + { + return base.Call(inputs, state, training); + } } } diff --git a/src/TensorFlowNET.Keras/Tensorflow.Keras.csproj b/src/TensorFlowNET.Keras/Tensorflow.Keras.csproj index 647601a7..d45c7de2 100644 --- a/src/TensorFlowNET.Keras/Tensorflow.Keras.csproj +++ b/src/TensorFlowNET.Keras/Tensorflow.Keras.csproj @@ -1,13 +1,13 @@  - netstandard2.0 + netstandard2.0;net6.0 Tensorflow.Keras 10.0 enable Tensorflow.Keras AnyCPU;x64 - 0.10.0 + 0.10.1 Haiping Chen Keras for .NET Apache 2.0, Haiping Chen 2021 @@ -37,8 +37,8 @@ Keras is an API designed for human beings, not machines. Keras follows best prac Git true Open.snk - 0.10.0.0 - 0.10.0.0 + 0.10.1.0 + 0.10.1.0 LICENSE Debug;Release;GPU