public class Sgd extends Object implements GradientUpdater
Modifier and Type | Class and Description |
---|---|
static class |
Sgd.SgdAggregator |
Constructor and Description |
---|
Sgd(double learningRate) |
Modifier and Type | Method and Description |
---|---|
GradientUpdaterAggregator |
getAggregator(boolean addThis)
Get a GradientUpdaterAggregator.
|
INDArray |
getGradient(INDArray gradient,
int iteration)
Modify the gradient
to be an update
|
void |
setStateViewArray(INDArray viewArray,
int[] gradientShape,
char gradientOrder,
boolean initialize)
For the internal updater state (if any): set this to use the provided array.
|
int |
stateSizeForInputSize(int inputSize)
For a give input size (length) array, how big is the internal state?
Typically 0, 1 or 2x the input size, depending on the type of updater
|
void |
update(Object... args)
update(learningRate,momentum)
|
public int stateSizeForInputSize(int inputSize)
GradientUpdater
stateSizeForInputSize
in interface GradientUpdater
inputSize
- Length of the input arraypublic void setStateViewArray(INDArray viewArray, int[] gradientShape, char gradientOrder, boolean initialize)
GradientUpdater
setStateViewArray
in interface GradientUpdater
viewArray
- Array (that is a view of a larger array) to use for the state.initialize
- If true: the updater must initialize the view array. If false: no change to view array contentspublic void update(Object... args)
GradientUpdater
update
in interface GradientUpdater
public INDArray getGradient(INDArray gradient, int iteration)
GradientUpdater
getGradient
in interface GradientUpdater
gradient
- the gradient to modifypublic GradientUpdaterAggregator getAggregator(boolean addThis)
GradientUpdater
getAggregator
in interface GradientUpdater
addThis
- If true: return a GradientUpdaterAggregator with the GradientUpdater already added.
If false: return an empty (uninitialized) GradientUpdaterAggregatorCopyright © 2016. All Rights Reserved.