Premium problem58. Manual Sigmoid Implementation

Easy Locked

Implement the sigmoid function by hand using the formula 1 / (1 + exp(-x)), rather than a built-in activation call.

Input

tensor([-2.0000, -0.5000,  0.0000,  1.0000,  3.0000])

Output

tensor([0.1192, 0.3775, 0.5000, 0.7311, 0.9526])

Only the returned value is graded, so a different approach will still pass. The constraint is the point of the exercise, not a rule the grader enforces.

Premium problem

This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.

Implement solve(...)