Sigmoid#
- class vulkpy.nn.Sigmoid#
Bases:
Module
Sigmoid
Methods Summary
__call__
(x)Call Module
backward
(dy)Backward
forward
(x)Forward
update
()Update parameters based on accumulated gradients
Reset accumulated gradients to 0.
Methods Documentation
- __call__(x: Array) Array #
Call Module
- Parameters:
x (vulkpy.Array) – Input
- Returns:
y – Output
- Return type:
- Raises:
ValueError – If input (
x
) shape doesn’t have at least 2-dimensions.
Notes
This function stores input (
x
) and output (y
) for training.
- backward(dy: Array) Array #
Backward
- Parameters:
dy (vulkpy.Array) – Batch grad
- Returns:
Batch grad
- Return type:
Notes
\[dx = dy \cdot y(1 - y)\]
- forward(x: Array) Array #
Forward
- Parameters:
x (vulkpy.Array) – Batch input
- Returns:
Batch output
- Return type:
Notes
\[y = 1/(1 + \exp (-x))\]Warning
Generally, users should not call this method directly. Use
__call__
instead, where input / output are stored for training.
- update()#
Update parameters based on accumulated gradients
Notes
Base class implement no-operation. Subclass can customize this method.
- zero_grad()#
Reset accumulated gradients to 0.
Notes
Base class implement no-operation. Subclass can customize this method.
- __init__()#