Skip to content

Commit

Permalink
add tri activation
Browse files Browse the repository at this point in the history
  • Loading branch information
ykeuter committed Apr 17, 2022
1 parent a120ef7 commit a0e892f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pytorch_neat/activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def relu_activation(x):
return F.relu(x)


def tri_activation(x):
return torch.clamp(1 - torch.abs(x), 0)


str_to_activation = {
'sigmoid': sigmoid_activation,
'tanh': tanh_activation,
Expand All @@ -52,4 +56,5 @@ def relu_activation(x):
'identity': identity_activation,
'sin': sin_activation,
'relu': relu_activation,
'tri': tri_activation,
}

0 comments on commit a0e892f

Please sign in to comment.