ONE - On-device Neural Engine
Loading...
Searching...
No Matches
sgd.py
Go to the documentation of this file.
1from typing import Optional
2from .optimizer import Optimizer
3
4
6 """
7 Stochastic Gradient Descent (SGD) optimizer.
8 """
9 def __init__(self, learning_rate: float = 0.001, momentum: float = 0.0) -> None:
10 """
11 Initialize the SGD optimizer.
12
13 Args:
14 learning_rate (float): The learning rate for optimization.
15 momentum (float): Momentum factor (default: 0.0).
16 """
17 super().__init__(learning_rate)
18
19 if momentum != 0.0:
20 raise NotImplementedError(
21 "Momentum is not supported in the current version of SGD.")
22 self.momentum: float = momentum
23 self.velocity: Optional[float] = None
None __init__(self, float learning_rate=0.001, float momentum=0.0)
Definition sgd.py:9