diff --git a/src/TensorFlowNET.Core/Keras/Activations/Activations.cs b/src/TensorFlowNET.Core/Keras/Activations/Activations.cs
index 4a0222e9..ea01b319 100644
--- a/src/TensorFlowNET.Core/Keras/Activations/Activations.cs
+++ b/src/TensorFlowNET.Core/Keras/Activations/Activations.cs
@@ -26,42 +26,56 @@ namespace Tensorflow.Keras
};
}
}
+
+ ///
+ /// The ActivationAdaptor is used to store string, Activation, and Func for Laysers Api to accept different types of activation parameters.
+ /// One of the properties must be specified while initializing.
+ ///
public class ActivationAdaptor
{
- public string? Name { get; set; }
+ ///
+ /// The name of activaiton function, such as `tanh`, `sigmoid`.
+ ///
+ public string? Name { get; set; } = null;
+
+ ///
+ /// The available Activation instance of activaiton function, such as keras.activations.Tanh, keras.activations.Sigmoid.
+ ///
+ public Activation? Activation { get; set; } = null;
+
+ ///
+ /// The Func definition of activation function, which can be customized.
+ ///
+ public Func? Func { get; set; } = null;
+
+ public ActivationAdaptor(string name)
+ {
+ Name = name;
+ }
- public Activation? Activation { get; set; }
+ public ActivationAdaptor(Activation activation)
+ {
+ Activation = activation;
+ }
- public Func? Func { get; set; }
+ public ActivationAdaptor(Func func)
+ {
+ Func = func;
+ }
public static implicit operator ActivationAdaptor(string name)
{
- return new ActivationAdaptor()
- {
- Name = name,
- Activation = null,
- Func = null
- };
+ return new ActivationAdaptor(name);
}
public static implicit operator ActivationAdaptor(Activation activation)
{
- return new ActivationAdaptor()
- {
- Name = null,
- Activation = activation,
- Func = null
- };
+ return new ActivationAdaptor(activation);
}
public static implicit operator ActivationAdaptor(Func func)
{
- return new ActivationAdaptor()
- {
- Name = null,
- Activation = null,
- Func = func
- };
+ return new ActivationAdaptor(func);
}
}
diff --git a/src/TensorFlowNET.Keras/Activations.cs b/src/TensorFlowNET.Keras/Activations.cs
index e26a97bd..4d08c77e 100644
--- a/src/TensorFlowNET.Keras/Activations.cs
+++ b/src/TensorFlowNET.Keras/Activations.cs
@@ -93,6 +93,13 @@ namespace Tensorflow.Keras
}
}
+ ///
+ /// Convert ActivationAdaptor to Activation.
+ /// If more than one properties of ActivationAdaptor are specified, the order of priority is `Name`, `Activation`, `Func`
+ ///
+ ///
+ ///
+ ///
public Activation GetActivationFromAdaptor(ActivationAdaptor adaptor)
{
if(adaptor == null)