From f5eb4ff0a0950fa1b0c3af9b67950e4f4dc90a1a Mon Sep 17 00:00:00 2001
From: Wanglongzhi2001 <583087864@qq.com>
Date: Sat, 26 Aug 2023 10:35:45 +0800
Subject: [PATCH 1/2] fix: partially fix the bug of load_model
---
.../ArgsDefinition/Activation/ExponentialArgs.cs | 10 ++++++++++
.../ArgsDefinition/Activation/HardSigmoidArgs.cs | 10 ++++++++++
.../Keras/ArgsDefinition/Activation/SELUArgs.cs | 11 +++++++++++
.../Keras/ArgsDefinition/Activation/SoftplusArgs.cs | 10 ++++++++++
.../Keras/ArgsDefinition/Activation/SoftsignArgs.cs | 10 ++++++++++
.../Keras/ArgsDefinition/Activation/SwishArgs.cs | 10 ++++++++++
.../Keras/ArgsDefinition/Activation/TanhArgs.cs | 10 ++++++++++
.../ArgsDefinition/Convolution/Conv2DTransposeArgs.cs | 10 ++++++++++
.../Keras/ArgsDefinition/Merging/AddArgs.cs | 10 ++++++++++
.../Keras/ArgsDefinition/Merging/ConcatenateArgs.cs | 10 ++++++++++
.../Keras/ArgsDefinition/Merging/SubtractArgs.cs | 10 ++++++++++
.../Pooling/GlobalAveragePooling1DArgs.cs | 10 ++++++++++
.../Pooling/GlobalAveragePooling2DArgs.cs | 10 ++++++++++
.../ArgsDefinition/Pooling/GlobalMaxPooling1DArgs.cs | 10 ++++++++++
.../ArgsDefinition/Pooling/GlobalMaxPooling2DArgs.cs | 10 ++++++++++
.../Keras/ArgsDefinition/Pooling/MaxPooling1DArgs.cs | 10 ++++++++++
16 files changed, 161 insertions(+)
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/ExponentialArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/HardSigmoidArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SELUArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SoftplusArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SoftsignArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SwishArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/TanhArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Convolution/Conv2DTransposeArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/AddArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/ConcatenateArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/SubtractArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalAveragePooling1DArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalAveragePooling2DArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalMaxPooling1DArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalMaxPooling2DArgs.cs
create mode 100644 src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/MaxPooling1DArgs.cs
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/ExponentialArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/ExponentialArgs.cs
new file mode 100644
index 000000000..ef024971d
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/ExponentialArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class ExponentialArgs : LayerArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/HardSigmoidArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/HardSigmoidArgs.cs
new file mode 100644
index 000000000..788e0f36d
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/HardSigmoidArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class HardSigmoidArgs : LayerArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SELUArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SELUArgs.cs
new file mode 100644
index 000000000..eb0e18446
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SELUArgs.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class SELUArgs : LayerArgs
+ {
+
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SoftplusArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SoftplusArgs.cs
new file mode 100644
index 000000000..7b4f20795
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SoftplusArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class SoftplusArgs : LayerArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SoftsignArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SoftsignArgs.cs
new file mode 100644
index 000000000..4e23d261d
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SoftsignArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class SoftsignArgs : LayerArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SwishArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SwishArgs.cs
new file mode 100644
index 000000000..3dea06a23
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/SwishArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class SwishArgs : LayerArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/TanhArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/TanhArgs.cs
new file mode 100644
index 000000000..5df41b71b
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Activation/TanhArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class TanhArgs : LayerArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Convolution/Conv2DTransposeArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Convolution/Conv2DTransposeArgs.cs
new file mode 100644
index 000000000..3daba9465
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Convolution/Conv2DTransposeArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class Conv2DTransposeArgs : Conv2DArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/AddArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/AddArgs.cs
new file mode 100644
index 000000000..016d58203
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/AddArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class AddArgs : MergeArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/ConcatenateArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/ConcatenateArgs.cs
new file mode 100644
index 000000000..4a81d139d
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/ConcatenateArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class ConcatenateArgs : MergeArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/SubtractArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/SubtractArgs.cs
new file mode 100644
index 000000000..1e3621cb6
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Merging/SubtractArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class SubtractArgs : MergeArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalAveragePooling1DArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalAveragePooling1DArgs.cs
new file mode 100644
index 000000000..e73aff766
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalAveragePooling1DArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class GlobalAveragePooling1DArgs : Pooling1DArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalAveragePooling2DArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalAveragePooling2DArgs.cs
new file mode 100644
index 000000000..d143cf471
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalAveragePooling2DArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class GlobalAveragePooling2DArgs : Pooling2DArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalMaxPooling1DArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalMaxPooling1DArgs.cs
new file mode 100644
index 000000000..e03227feb
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalMaxPooling1DArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class GlobalMaxPooling1DArgs : Pooling1DArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalMaxPooling2DArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalMaxPooling2DArgs.cs
new file mode 100644
index 000000000..a95cac836
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/GlobalMaxPooling2DArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class GlobalMaxPooling2DArgs : Pooling2DArgs
+ {
+ }
+}
diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/MaxPooling1DArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/MaxPooling1DArgs.cs
new file mode 100644
index 000000000..4cfff2c15
--- /dev/null
+++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Pooling/MaxPooling1DArgs.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Keras.ArgsDefinition
+{
+ public class MaxPooling1DArgs : Pooling1DArgs
+ {
+ }
+}
From f679af67e61c51bee1aca254f993d6d137df07ff Mon Sep 17 00:00:00 2001
From: Wanglongzhi2001 <583087864@qq.com>
Date: Sat, 26 Aug 2023 11:36:41 +0800
Subject: [PATCH 2/2] fix: partially fix the bug of load_model
---
.../Layers/LayersApi.Activation.cs | 14 +++++++-------
.../Layers/LayersApi.Merging.cs | 2 +-
src/TensorFlowNET.Keras/Layers/LayersApi.cs | 18 +++++++++---------
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs b/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs
index 280e91e2c..2c55f8fd5 100644
--- a/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs
+++ b/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs
@@ -10,14 +10,14 @@ public partial class LayersApi {
public ILayer ELU ( float alpha = 0.1f )
=> new ELU(new ELUArgs { Alpha = alpha });
public ILayer SELU ()
- => new SELU(new LayerArgs { });
+ => new SELU(new SELUArgs { });
public ILayer Softmax(int axis = -1) => new Softmax(new SoftmaxArgs { axis = axis });
public ILayer Softmax ( Axis axis ) => new Softmax(new SoftmaxArgs { axis = axis });
- public ILayer Softplus () => new Softplus(new LayerArgs { });
- public ILayer HardSigmoid () => new HardSigmoid(new LayerArgs { });
- public ILayer Softsign () => new Softsign(new LayerArgs { });
- public ILayer Swish () => new Swish(new LayerArgs { });
- public ILayer Tanh () => new Tanh(new LayerArgs { });
- public ILayer Exponential () => new Exponential(new LayerArgs { });
+ public ILayer Softplus () => new Softplus(new SoftplusArgs { });
+ public ILayer HardSigmoid () => new HardSigmoid(new HardSigmoidArgs { });
+ public ILayer Softsign () => new Softsign(new SoftsignArgs { });
+ public ILayer Swish () => new Swish(new SwishArgs { });
+ public ILayer Tanh () => new Tanh(new TanhArgs { });
+ public ILayer Exponential () => new Exponential(new ExponentialArgs { });
}
}
diff --git a/src/TensorFlowNET.Keras/Layers/LayersApi.Merging.cs b/src/TensorFlowNET.Keras/Layers/LayersApi.Merging.cs
index d94bfb4d8..bf06b1418 100644
--- a/src/TensorFlowNET.Keras/Layers/LayersApi.Merging.cs
+++ b/src/TensorFlowNET.Keras/Layers/LayersApi.Merging.cs
@@ -14,7 +14,7 @@ public partial class LayersApi
/// Axis along which to concatenate.
///
public ILayer Concatenate(int axis = -1)
- => new Concatenate(new MergeArgs
+ => new Concatenate(new ConcatenateArgs
{
Axis = axis
});
diff --git a/src/TensorFlowNET.Keras/Layers/LayersApi.cs b/src/TensorFlowNET.Keras/Layers/LayersApi.cs
index a04a9c051..9155c7742 100644
--- a/src/TensorFlowNET.Keras/Layers/LayersApi.cs
+++ b/src/TensorFlowNET.Keras/Layers/LayersApi.cs
@@ -240,7 +240,7 @@ public ILayer Conv2DTranspose(int filters,
string kernel_regularizer = null,
string bias_regularizer = null,
string activity_regularizer = null)
- => new Conv2DTranspose(new Conv2DArgs
+ => new Conv2DTranspose(new Conv2DTransposeArgs
{
Rank = 2,
Filters = filters,
@@ -568,7 +568,7 @@ public ILayer MaxPooling1D(int? pool_size = null,
int? strides = null,
string padding = "valid",
string data_format = null)
- => new MaxPooling1D(new Pooling1DArgs
+ => new MaxPooling1D(new MaxPooling1DArgs
{
PoolSize = pool_size ?? 2,
Strides = strides ?? (pool_size ?? 2),
@@ -944,21 +944,21 @@ public ILayer Rescaling(float scale,
///
///
public ILayer Add()
- => new Add(new MergeArgs { });
+ => new Add(new AddArgs { });
///
///
///
///
public ILayer Subtract()
- => new Subtract(new MergeArgs { });
+ => new Subtract(new SubtractArgs { });
///
/// Global max pooling operation for spatial data.
///
///
public ILayer GlobalAveragePooling2D()
- => new GlobalAveragePooling2D(new Pooling2DArgs { });
+ => new GlobalAveragePooling2D(new GlobalAveragePooling2DArgs { });
///
/// Global average pooling operation for temporal data.
@@ -968,7 +968,7 @@ public ILayer GlobalAveragePooling2D()
///
///
public ILayer GlobalAveragePooling1D(string data_format = "channels_last")
- => new GlobalAveragePooling1D(new Pooling1DArgs { DataFormat = data_format });
+ => new GlobalAveragePooling1D(new GlobalAveragePooling1DArgs { DataFormat = data_format });
///
/// Global max pooling operation for spatial data.
@@ -977,7 +977,7 @@ public ILayer GlobalAveragePooling1D(string data_format = "channels_last")
/// channels_last corresponds to inputs with shape (batch, height, width, channels) while channels_first corresponds to inputs with shape (batch, channels, height, width).
///
public ILayer GlobalAveragePooling2D(string data_format = "channels_last")
- => new GlobalAveragePooling2D(new Pooling2DArgs { DataFormat = data_format });
+ => new GlobalAveragePooling2D(new GlobalAveragePooling2DArgs { DataFormat = data_format });
///
/// Global max pooling operation for 1D temporal data.
@@ -988,7 +988,7 @@ public ILayer GlobalAveragePooling2D(string data_format = "channels_last")
///
///
public ILayer GlobalMaxPooling1D(string data_format = "channels_last")
- => new GlobalMaxPooling1D(new Pooling1DArgs { DataFormat = data_format });
+ => new GlobalMaxPooling1D(new GlobalMaxPooling1DArgs { DataFormat = data_format });
///
/// Global max pooling operation for spatial data.
@@ -997,7 +997,7 @@ public ILayer GlobalMaxPooling1D(string data_format = "channels_last")
/// channels_last corresponds to inputs with shape (batch, height, width, channels) while channels_first corresponds to inputs with shape (batch, channels, height, width).
///
public ILayer GlobalMaxPooling2D(string data_format = "channels_last")
- => new GlobalMaxPooling2D(new Pooling2DArgs { DataFormat = data_format });
+ => new GlobalMaxPooling2D(new GlobalMaxPooling2DArgs { DataFormat = data_format });
///
/// Get an weights initializer from its name.