All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nd4j.linalg.learning.NoOpUpdater Maven / Gradle / Ivy

There is a newer version: 1.0.0-M2.1
Show newest version
package org.nd4j.linalg.learning;

import lombok.EqualsAndHashCode;
import org.nd4j.linalg.api.ndarray.INDArray;

/**
 * Created by Alex on 08/09/2016.
 */
public class NoOpUpdater implements GradientUpdater {
    @Override
    public int stateSizeForInputSize(int inputSize) {
        return 0;
    }

    @Override
    public void setStateViewArray(INDArray viewArray, int[] shape, char order, boolean initialize) {
        //No op
    }

    @Override
    public void update(Object... args) {
        //No op
    }

    @Override
    public INDArray getGradient(INDArray gradient, int iteration) {
        return gradient;
    }

    @Override
    public GradientUpdaterAggregator getAggregator(boolean addThis) {
        return new NoOpUpdaterAggregator();
    }

    @EqualsAndHashCode
    private static class NoOpUpdaterAggregator implements GradientUpdaterAggregator{
        @Override
        public GradientUpdater getUpdater() {
            return new NoOpUpdater();
        }

        @Override
        public void aggregate(GradientUpdater updater) {
            //No op
        }

        @Override
        public GradientUpdaterAggregator combine(GradientUpdaterAggregator other) {
            return this;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy