Module#
- class vulkpy.nn.Module#
Bases:
objectAbstract base class for Module
See also
vulkpy.nn.DenseDense Layer (subclass)
vulkpy.nn.ReLUReLU Layer (subclass)
vulkpy.nn.SigmoidSigmoid Layer (subclass)
vulkpy.nn.SoftmaxSoftmax Layer (subclass)
vulkpy.nn.SequenceSequential Model
Notes
Moduleis designed to for Neural Network Layer.Subclass must implement
forward()andbackward(), and can implementzero_grad()andupdate()when it is necessary.Methods Summary
__call__(x)Call Module
backward(dy)Backward Calculation
forward(x)Forward Calculation
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 Calculation
- Parameters:
dy (vulkpy.Array) – dL/dy propagated from following layer
- Returns:
dx – dL/dx propagated to previous layer
- Return type:
Notes
Subclass must implement this method.
- forward(x: Array) Array#
Forward Calculation
- Parameters:
x (vulkpy.Array) – Input features
- Returns:
y – Output
- Return type:
Notes
Subclass must implement this method.
- 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__()#