ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
optimizer.sgd.SGD Class Reference
Collaboration diagram for optimizer.sgd.SGD:

Public Member Functions

 __init__ (self, learning_rate=0.001, momentum=0.0)
 

Data Fields

 momentum
 
 velocity
 
- Data Fields inherited from optimizer.optimizer.Optimizer
 learning_rate
 
 nums_trainable_ops
 

Detailed Description

Stochastic Gradient Descent (SGD) optimizer.

Definition at line 4 of file sgd.py.

Constructor & Destructor Documentation

◆ __init__()

optimizer.sgd.SGD.__init__ (   self,
  learning_rate = 0.001,
  momentum = 0.0 
)
Initialize the SGD optimizer.
Args:
    learning_rate (float): The learning rate for optimization.
    momentum (float): Momentum factor (default: 0.0).

Reimplemented from optimizer.optimizer.Optimizer.

Definition at line 8 of file sgd.py.

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

References optimizer.sgd.SGD.__init__().

Referenced by optimizer.sgd.SGD.__init__().

Field Documentation

◆ momentum

optimizer.sgd.SGD.momentum

Definition at line 20 of file sgd.py.

◆ velocity

optimizer.sgd.SGD.velocity

Definition at line 21 of file sgd.py.


The documentation for this class was generated from the following file: