@Test public void when_callingUpdate_expect_handlerCalledAndThreadCurrentUpdated() { NeuralNetUpdaterConfiguration configuration = NeuralNetUpdaterConfiguration.builder() .targetUpdateFrequency(2) .build(); AsyncLabelsNeuralNetUpdater sut = new AsyncLabelsNeuralNetUpdater(threadCurrentMock, asyncSharedNetworksUpdateHandlerMock); FeaturesLabels featureLabels = new FeaturesLabels(null); Gradients gradients = new Gradients(10); when(threadCurrentMock.computeGradients(featureLabels)).thenReturn(gradients); sut.update(featureLabels); verify(threadCurrentMock, times(1)).computeGradients(featureLabels); verify(asyncSharedNetworksUpdateHandlerMock, times(1)).handleGradients(gradients); verify(threadCurrentMock, times(0)).copyFrom(any()); }
@Override public void update(FeaturesLabels featuresLabels) { Gradients gradients = threadCurrent.computeGradients(featuresLabels); updateAndSync(gradients); }
AsyncLabelsNeuralNetUpdater extends BaseAsyncNeuralNetUpdater<FeaturesLabels> { @Override public void update(FeaturesLabels featuresLabels) { Gradients gradients = threadCurrent.computeGradients(featuresLabels); updateAndSync(gradients); } }
AsyncLabelsNeuralNetUpdater extends BaseAsyncNeuralNetUpdater<FeaturesLabels> { @Override public void update(FeaturesLabels featuresLabels) { Gradients gradients = threadCurrent.computeGradients(featuresLabels); updateAndSync(gradients); } AsyncLabelsNeuralNetUpdater(ITrainableNeuralNet threadCurrent,
                                       AsyncSharedNetworksUpdateHandler sharedNetworksUpdateHandler); }
AsyncLabelsNeuralNetUpdater extends BaseAsyncNeuralNetUpdater<FeaturesLabels> { @Override public void update(FeaturesLabels featuresLabels) { Gradients gradients = threadCurrent.computeGradients(featuresLabels); updateAndSync(gradients); } AsyncLabelsNeuralNetUpdater(ITrainableNeuralNet threadCurrent,
                                       AsyncSharedNetworksUpdateHandler sharedNetworksUpdateHandler); @Override void update(FeaturesLabels featuresLabels); }
AsyncLabelsNeuralNetUpdater extends BaseAsyncNeuralNetUpdater<FeaturesLabels> { @Override public void update(FeaturesLabels featuresLabels) { Gradients gradients = threadCurrent.computeGradients(featuresLabels); updateAndSync(gradients); } AsyncLabelsNeuralNetUpdater(ITrainableNeuralNet threadCurrent,
                                       AsyncSharedNetworksUpdateHandler sharedNetworksUpdateHandler); @Override void update(FeaturesLabels featuresLabels);  }