org.nd4j.linalg.learning.NadamUpdater Java Examples

The following examples show how to use org.nd4j.linalg.learning.NadamUpdater. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NadamLearnerTestCase.java    From jstarcraft-ai with Apache License 2.0 5 votes vote down vote up
@Override
protected GradientUpdater<?> getOldFunction(long[] shape) {
    Nadam configuration = new Nadam();
    GradientUpdater<?> oldFunction = new NadamUpdater(configuration);
    int length = (int) (shape[0] * configuration.stateSize(shape[1]));
    INDArray view = Nd4j.zeros(length);
    oldFunction.setStateViewArray(view, shape, 'c', true);
    return oldFunction;
}
 
Example #2
Source File: Nadam.java    From nd4j with Apache License 2.0 5 votes vote down vote up
@Override
public GradientUpdater instantiate(INDArray viewArray, boolean initializeViewArray) {
    NadamUpdater u = new NadamUpdater(this);
    long[] gradientShape = viewArray.shape();
    gradientShape = Arrays.copyOf(gradientShape, gradientShape.length);
    gradientShape[1] /= 2;
    u.setStateViewArray(viewArray, gradientShape, viewArray.ordering(), initializeViewArray);
    return u;
}
 
Example #3
Source File: Nadam.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public GradientUpdater instantiate(INDArray viewArray, boolean initializeViewArray) {
    NadamUpdater u = new NadamUpdater(this);
    long[] gradientShape = viewArray.shape();
    gradientShape = Arrays.copyOf(gradientShape, gradientShape.length);
    gradientShape[1] /= 2;
    u.setStateViewArray(viewArray, gradientShape, viewArray.ordering(), initializeViewArray);
    return u;
}
 
Example #4
Source File: Nadam.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Override
public GradientUpdater instantiate(Map<String, INDArray> updaterState, boolean initializeStateArrays) {
    NadamUpdater u = new NadamUpdater(this);
    u.setState(updaterState, initializeStateArrays);
    return u;
}