From b0d850cdbbef735e46156ee18d5436ffd4d531d8 Mon Sep 17 00:00:00 2001 From: Yaohui Liu Date: Sat, 4 Mar 2023 21:51:47 +0800 Subject: [PATCH] Add default value of parameter of keras softmax. --- src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs | 1 + src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs | 1 + .../SaveModel/SequentialModelSave.cs | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs b/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs index 73a6787c3..524798690 100644 --- a/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs +++ b/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs @@ -9,6 +9,7 @@ public partial interface ILayersApi { public ILayer ELU(float alpha = 0.1f); public ILayer SELU(); + public ILayer Softmax(int axis = -1); public ILayer Softmax(Axis axis); public ILayer Softplus(); public ILayer HardSigmoid(); diff --git a/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs b/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs index 24a568390..280e91e2c 100644 --- a/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs +++ b/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs @@ -11,6 +11,7 @@ public ILayer ELU ( float alpha = 0.1f ) => new ELU(new ELUArgs { Alpha = alpha }); public ILayer SELU () => new SELU(new LayerArgs { }); + 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 { }); diff --git a/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelSave.cs b/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelSave.cs index 5b7c2b62e..15823b9f4 100644 --- a/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelSave.cs +++ b/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelSave.cs @@ -54,7 +54,7 @@ public void SimpleModelFromSequential() keras.layers.Flatten(), keras.layers.Dense(100, "relu"), keras.layers.Dense(10), - keras.layers.Softmax(1) + keras.layers.Softmax() }); model.summary();