diff --git a/src/TensorFlowNET.Core/APIs/tf.nn.cs b/src/TensorFlowNET.Core/APIs/tf.nn.cs index 64d47acd..b2ac4e94 100644 --- a/src/TensorFlowNET.Core/APIs/tf.nn.cs +++ b/src/TensorFlowNET.Core/APIs/tf.nn.cs @@ -111,6 +111,7 @@ namespace Tensorflow name: name); public IActivation relu() => new relu(); + public IActivation swish() => new swish(); public Tensor relu(Tensor features, string name = null) => gen_nn_ops.relu(features, name); @@ -206,6 +207,9 @@ namespace Tensorflow public Tensor softmax_cross_entropy_with_logits_v2(Tensor labels, Tensor logits, int axis = -1, string name = null) => nn_ops.softmax_cross_entropy_with_logits_v2_helper(labels, logits, axis: axis, name: name); + + public Tensor sigmoid(T x, string name = null) + => math_ops.sigmoid(x, name: name); } } } diff --git a/src/TensorFlowNET.Core/Operations/Activation/gen_nn_ops.activations.cs b/src/TensorFlowNET.Core/Operations/Activation/gen_nn_ops.activations.cs index 788adda4..775fa9a8 100644 --- a/src/TensorFlowNET.Core/Operations/Activation/gen_nn_ops.activations.cs +++ b/src/TensorFlowNET.Core/Operations/Activation/gen_nn_ops.activations.cs @@ -102,6 +102,14 @@ namespace Tensorflow.Operations.Activation } } + public class swish : IActivation + { + public Tensor Activate(Tensor x, string name = null) + { + return tf.multiply(x, tf.nn.sigmoid(x)); + } + } + public class linear : IActivation { public Tensor Activate(Tensor x, string name = null)