softplus activation function use case the softplus function is a smooth approximation of the relu function for more detailed information you can refer to the following link https en wikipedia orgwikirectifierneuralnetworkssoftplus implements the softplus activation function parameters vector np ndarray the input array for the softplus activation returns np ndarray the input array after applying the softplus activation formula fx ln1 ex examples softplusnp array2 3 0 6 2 3 8 array2 39554546 1 03748795 0 12692801 0 02212422 softplusnp array9 2 0 3 0 45 4 56 array1 01034298e04 5 54355244e01 9 43248946e01 1 04077103e02 implements the softplus activation function parameters vector np ndarray the input array for the softplus activation returns np ndarray the input array after applying the softplus activation formula f x ln 1 e x examples softplus np array 2 3 0 6 2 3 8 array 2 39554546 1 03748795 0 12692801 0 02212422 softplus np array 9 2 0 3 0 45 4 56 array 1 01034298e 04 5 54355244e 01 9 43248946e 01 1 04077103e 02
import numpy as np


def softplus(vector: np.ndarray) -> np.ndarray:
    
    return np.log(1 + np.exp(vector))


if __name__ == "__main__":
    import doctest

    doctest.testmod()