Browse Source

RegularizerAPI

pull/1248/head
Sean Chen 1 year ago
parent
commit
508698d7b2
2 changed files with 16 additions and 2 deletions
  1. +9
    -1
      src/TensorFlowNET.Core/Keras/Regularizers/IRegularizer.cs
  2. +7
    -1
      src/TensorFlowNET.Keras/Regularizers.cs

+ 9
- 1
src/TensorFlowNET.Core/Keras/Regularizers/IRegularizer.cs View File

@@ -12,5 +12,13 @@ namespace Tensorflow.Keras
[JsonProperty("config")]
IDictionary<string, object> Config { get; }
Tensor Apply(RegularizerArgs args);
}
}

public interface IRegularizerApi
{
IRegularizer L1 { get; }
IRegularizer L2 { get; }
IRegularizer L1L2 { get; }
}

}

+ 7
- 1
src/TensorFlowNET.Keras/Regularizers.cs View File

@@ -1,6 +1,6 @@
namespace Tensorflow.Keras
{
public class Regularizers
public class Regularizers: IRegularizerApi
{
public IRegularizer l1(float l1 = 0.01f)
=> new Tensorflow.Operations.Regularizers.L1(l1);
@@ -13,5 +13,11 @@
//# and no l1 penalty.
public IRegularizer l1l2(float l1 = 0.00f, float l2 = 0.00f)
=> new Tensorflow.Operations.Regularizers.L1L2(l1, l2);

public IRegularizer L1 => l1();

public IRegularizer L2 => l2();

public IRegularizer L1L2 => l1l2();
}
}

Loading…
Cancel
Save