@Test public void when_callingComputeGradients_expect_handlerComputeGradientsIsNotifiedAndResponseIsFilled() { setup(false); FeaturesLabels featuresLabels = new FeaturesLabels(Nd4j.create(12, 1)); Gradients gradientsMock = mock(Gradients.class); Gradients response = sut.computeGradients(featuresLabels); verify(handlerMock, times(1)).performGradientsComputation(featuresLabels); verify(handlerMock, times(1)).notifyGradientCalculation(); verify(handlerMock, times(1)).fillGradientsResponse(response); assertEquals(response.getBatchSize(), 12); }
@Override public Gradients computeGradients(FeaturesLabels featuresLabels) { networkHandler.performGradientsComputation(featuresLabels); networkHandler.notifyGradientCalculation(); Gradients results = new Gradients(featuresLabels.getBatchSize()); networkHandler.fillGradientsResponse(results); return results; }
BaseNetwork implements ITrainableNeuralNet<NET_TYPE> { @Override public Gradients computeGradients(FeaturesLabels featuresLabels) { networkHandler.performGradientsComputation(featuresLabels); networkHandler.notifyGradientCalculation(); Gradients results = new Gradients(featuresLabels.getBatchSize()); networkHandler.fillGradientsResponse(results); return results; } }
BaseNetwork implements ITrainableNeuralNet<NET_TYPE> { @Override public Gradients computeGradients(FeaturesLabels featuresLabels) { networkHandler.performGradientsComputation(featuresLabels); networkHandler.notifyGradientCalculation(); Gradients results = new Gradients(featuresLabels.getBatchSize()); networkHandler.fillGradientsResponse(results); return results; } protected  BaseNetwork(INetworkHandler networkHandler); }
BaseNetwork implements ITrainableNeuralNet<NET_TYPE> { @Override public Gradients computeGradients(FeaturesLabels featuresLabels) { networkHandler.performGradientsComputation(featuresLabels); networkHandler.notifyGradientCalculation(); Gradients results = new Gradients(featuresLabels.getBatchSize()); networkHandler.fillGradientsResponse(results); return results; } protected  BaseNetwork(INetworkHandler networkHandler); boolean isRecurrent(); @Override void fit(FeaturesLabels featuresLabels); @Override Gradients computeGradients(FeaturesLabels featuresLabels); @Override void applyGradients(Gradients gradients); @Override NeuralNetOutput output(Observation observation); NeuralNetOutput output(INDArray batch); @Override void reset(); void copyFrom(BaseNetwork from); abstract NET_TYPE clone(); }
BaseNetwork implements ITrainableNeuralNet<NET_TYPE> { @Override public Gradients computeGradients(FeaturesLabels featuresLabels) { networkHandler.performGradientsComputation(featuresLabels); networkHandler.notifyGradientCalculation(); Gradients results = new Gradients(featuresLabels.getBatchSize()); networkHandler.fillGradientsResponse(results); return results; } protected  BaseNetwork(INetworkHandler networkHandler); boolean isRecurrent(); @Override void fit(FeaturesLabels featuresLabels); @Override Gradients computeGradients(FeaturesLabels featuresLabels); @Override void applyGradients(Gradients gradients); @Override NeuralNetOutput output(Observation observation); NeuralNetOutput output(INDArray batch); @Override void reset(); void copyFrom(BaseNetwork from); abstract NET_TYPE clone();  }