Skip to content

Commit

Permalink
increase default threshold to 40 in brainpy.math.softplus
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 committed Jan 3, 2024
1 parent a8ae48b commit 46d4c46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions brainpy/_src/dnn/activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ class Softplus(Layer):
Args:
beta: the :math:`\beta` value for the Softplus formulation. Default: 1
threshold: values above this revert to a linear function. Default: 20
threshold: values above this revert to a linear function. Default: 40
Shape:
- Input: :math:`(*)`, where :math:`*` means any number of dimensions.
Expand All @@ -843,7 +843,7 @@ class Softplus(Layer):
beta: int
threshold: int

def __init__(self, beta: int = 1, threshold: int = 20) -> None:
def __init__(self, beta: int = 1, threshold: int = 40) -> None:
super().__init__()
self.beta = beta
self.threshold = threshold
Expand Down
4 changes: 2 additions & 2 deletions brainpy/_src/math/activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def leaky_relu(x, negative_slope=1e-2):
return jnp.where(x >= 0, x, negative_slope * x)


def softplus(x, beta=1, threshold=20):
def softplus(x, beta=1, threshold=40):
r"""Softplus activation function.
Computes the element-wise function
Expand All @@ -316,7 +316,7 @@ def softplus(x, beta=1, threshold=20):
----------
x: The input array.
beta: the :math:`\beta` value for the Softplus formulation. Default: 1
threshold: values above this revert to a linear function. Default: 20
threshold: values above this revert to a linear function. Default: 40
"""
x = x.value if isinstance(x, Array) else x
Expand Down

0 comments on commit 46d4c46

Please sign in to comment.