Softplus Activation

EasyMachine LearningMathArray

Description

Given an array of numbers, apply the Softplus activation ln(1 + e^x) to each element. Round each result to 4 decimal places.

Examples

Input:[0,1,-1]
Output:[0.6931,1.3133,0.3133]
Explanation:

Softplus is a smooth approximation of ReLU that bends gently through ln(2) at zero and approaches the input for large positive values.

Input:[2]
Output:[2.1269]
Explanation:

Softplus is a smooth approximation of ReLU that bends gently through ln(2) at zero and approaches the input for large positive values.

Input:[-2,2]
Output:[0.1269,2.1269]
Explanation:

Softplus is a smooth approximation of ReLU that bends gently through ln(2) at zero and approaches the input for large positive values.

Constraints

  • 1 ≤ length ≤ 10⁴

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.