ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sgd.py
Go to the documentation of this file.
1from .optimizer import Optimizer
2
3
5 """
6 Stochastic Gradient Descent (SGD) optimizer.
7 """
8 def __init__(self, learning_rate=0.001, momentum=0.0):
9 """
10 Initialize the SGD optimizer.
11 Args:
12 learning_rate (float): The learning rate for optimization.
13 momentum (float): Momentum factor (default: 0.0).
14 """
15 super().__init__(learning_rate)
16
17 if momentum != 0.0:
18 raise NotImplementedError(
19 "Momentum is not supported in the current version of SGD.")
20 self.momentum = momentum
21 self.velocity = None
__init__(self, learning_rate=0.001, momentum=0.0)
Definition sgd.py:8