How can I create a differentiable function to cap at 100?

70 Views Asked by At

How can implement a function similar to $ \ln \bigl( \frac{1}{1+e^{-x}} \bigl) $

enter image description here

It should be below piecewise function and should be differentiable

f(n) = \begin{cases} x, & \text{if $x$ < 100} \\ \to 100, & \text{otherwise} \end{cases}

I need this function to implement a differentiable activation function in pytorch. I tried functions like below, which didn't help

my shot at fn