The Softsign function is an activation function with a smooth S-shaped curve, like the sigmoid function.
Its shape resembles the Tanh function, but its derivative has a sharper peak.
Activation Functions
Updated:
The Softsign function is an activation function with a smooth S-shaped curve, like the sigmoid function.
Its shape resembles the Tanh function, but its derivative has a sharper peak.
# PyTorch
import torch
import torch.nn as nn
class NN(nn.Module):
def __init__(self):
super().__init__()
def softsign(self, x):
return x / (1 + torch.abs(x))
def forward(self, x):
x = self.softsign(x)
return x