Skip to content

Commit 4f88109

Browse files
committed
fix _self_tracked_trackables.
1 parent 56a64da commit 4f88109

File tree

8 files changed

+28
-19
lines changed

8 files changed

+28
-19
lines changed

src/TensorFlowNET.Core/Keras/IInitializersApi.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ namespace Tensorflow.Keras
77
public interface IInitializersApi
88
{
99
IInitializer Orthogonal(float gain = 1.0f, int? seed = null);
10+
11+
IInitializer HeNormal(int? seed = null);
1012
}
1113
}

src/TensorFlowNET.Core/Tensorflow.Binding.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
55
<AssemblyName>Tensorflow.Binding</AssemblyName>
66
<RootNamespace>Tensorflow</RootNamespace>
7-
<TargetTensorFlow>2.2.0</TargetTensorFlow>
8-
<Version>0.100.0</Version>
7+
<TargetTensorFlow>2.10.0</TargetTensorFlow>
8+
<Version>0.100.1</Version>
99
<LangVersion>10.0</LangVersion>
1010
<Nullable>enable</Nullable>
1111
<Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors>
@@ -20,7 +20,7 @@
2020
<Description>Google's TensorFlow full binding in .NET Standard.
2121
Building, training and infering deep learning models.
2222
https://tensorflownet.readthedocs.io</Description>
23-
<AssemblyVersion>0.100.0.0</AssemblyVersion>
23+
<AssemblyVersion>0.100.1.0</AssemblyVersion>
2424
<PackageReleaseNotes>
2525
tf.net 0.100.x and above are based on tensorflow native 2.10.0
2626

@@ -38,7 +38,7 @@ https://tensorflownet.readthedocs.io</Description>
3838
tf.net 0.7x.x aligns with TensorFlow v2.7.x native library.
3939
tf.net 0.10x.x aligns with TensorFlow v2.10.x native library.
4040
</PackageReleaseNotes>
41-
<FileVersion>0.100.0.0</FileVersion>
41+
<FileVersion>0.100.1.0</FileVersion>
4242
<PackageLicenseFile>LICENSE</PackageLicenseFile>
4343
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
4444
<SignAssembly>true</SignAssembly>
@@ -108,7 +108,7 @@ https://tensorflownet.readthedocs.io</Description>
108108

109109
<ItemGroup>
110110
<PackageReference Include="MethodBoundaryAspect.Fody" Version="2.0.148" />
111-
<PackageReference Include="Protobuf.Text" Version="0.5.0" />
111+
<PackageReference Include="Protobuf.Text" Version="0.6.0" />
112112
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
113113
</ItemGroup>
114114
</Project>

src/TensorFlowNET.Keras/Engine/Functional.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ protected void _init_graph_network(Tensors inputs, Tensors outputs)
6565
}
6666

6767
// Keep track of the network's nodes and layers.
68-
(NetworkNodes, NodesByDepth, var layers, _) = MapGraphNetwork(inputs, outputs);
69-
70-
if (!_self_tracked_trackables.Any())
71-
{
72-
_self_tracked_trackables = layers;
73-
}
68+
(NetworkNodes, NodesByDepth, _self_tracked_trackables, _) = MapGraphNetwork(inputs, outputs);
7469

7570
// Build self.input_names and self.output_names.
7671
_set_output_names();

src/TensorFlowNET.Keras/Engine/Sequential.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public void add(ILayer layer)
110110
}
111111
else if (outputs != null)
112112
{
113+
// If the model is being built continuously on top of an input layer:
114+
// refresh its output.
113115
outputs = layer.Apply(outputs);
114116
built = true;
115117
}
@@ -155,7 +157,7 @@ void _build_graph_network_for_inferred_shape(Shape input_shape, TF_DataType inpu
155157
Tensors layer_output = null;
156158
Tensors outputs = null;
157159
List<INode> created_nodes = new List<INode>();
158-
foreach (var layer in _self_tracked_trackables)
160+
foreach (var layer in args.Layers)
159161
{
160162
clear_previously_created_nodes(layer, _created_nodes);
161163
layer_output = layer.Apply(layer_input);

src/TensorFlowNET.Keras/InitializersApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class InitializersApi : IInitializersApi
2525
/// </summary>
2626
/// <param name="seed"></param>
2727
/// <returns></returns>
28-
public IInitializer he_normal(int? seed = null)
28+
public IInitializer HeNormal(int? seed = null)
2929
{
3030
return new VarianceScaling(factor: 2.0f, mode: "fan_in", seed: seed);
3131
}

src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public override void build(Shape input_shape)
4545
}
4646
}
4747

48+
protected override Tensors Call(Tensors inputs, Tensor state = null, bool? training = null)
49+
{
50+
return base.Call(inputs, state, training);
51+
}
52+
4853
private static RNNArgs PreConstruct(RNNArgs args)
4954
{
5055
if (args.Kwargs == null)

src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ public override void build(Shape input_shape)
3333
if (args.UseBias)
3434
{
3535
bias = add_weight("bias", (args.Units),
36-
initializer: args.RecurrentInitializer
36+
initializer: args.BiasInitializer
3737
);
3838
}
3939

4040
built = true;
4141
}
42+
43+
protected override Tensors Call(Tensors inputs, Tensor state = null, bool? training = null)
44+
{
45+
return base.Call(inputs, state, training);
46+
}
4247
}
4348
}

src/TensorFlowNET.Keras/Tensorflow.Keras.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
55
<AssemblyName>Tensorflow.Keras</AssemblyName>
66
<LangVersion>10.0</LangVersion>
77
<Nullable>enable</Nullable>
88
<RootNamespace>Tensorflow.Keras</RootNamespace>
99
<Platforms>AnyCPU;x64</Platforms>
10-
<Version>0.10.0</Version>
10+
<Version>0.10.1</Version>
1111
<Authors>Haiping Chen</Authors>
1212
<Product>Keras for .NET</Product>
1313
<Copyright>Apache 2.0, Haiping Chen 2021</Copyright>
@@ -37,8 +37,8 @@ Keras is an API designed for human beings, not machines. Keras follows best prac
3737
<RepositoryType>Git</RepositoryType>
3838
<SignAssembly>true</SignAssembly>
3939
<AssemblyOriginatorKeyFile>Open.snk</AssemblyOriginatorKeyFile>
40-
<AssemblyVersion>0.10.0.0</AssemblyVersion>
41-
<FileVersion>0.10.0.0</FileVersion>
40+
<AssemblyVersion>0.10.1.0</AssemblyVersion>
41+
<FileVersion>0.10.1.0</FileVersion>
4242
<PackageLicenseFile>LICENSE</PackageLicenseFile>
4343
<Configurations>Debug;Release;GPU</Configurations>
4444
</PropertyGroup>

0 commit comments

Comments
 (0)