@Test public void when_callingperformGradientsComputation_expect_modelCalledWithCorrectFeaturesLabels() { setup(false); INDArray features = Nd4j.rand(1, 2); INDArray labels = Nd4j.rand(1, 2); FeaturesLabels featuresLabels = new FeaturesLabels(features); featuresLabels.putLabels("TEST_LABEL", labels); sut.performGradientsComputation(featuresLabels); verify(modelMock, times(1)).setInput(0, features); ArgumentCaptor<INDArray> labelsCaptor = ArgumentCaptor.forClass(INDArray.class); verify(modelMock, times(1)).setLabels(labelsCaptor.capture()); Object debug = labelsCaptor.getAllValues(); INDArray labelsArg = labelsCaptor.getValue(); assertSame(labels, labelsArg); verify(modelMock, times(1)).computeGradientAndScore(); }
@Override public void performGradientsComputation(FeaturesLabels featuresLabels) { model.setInput(0, featuresLabels.getFeatures()); model.setLabels(getLabelsFromFeaturesLabels(featuresLabels)); model.computeGradientAndScore(); }
ComputationGraphHandler implements INetworkHandler { @Override public void performGradientsComputation(FeaturesLabels featuresLabels) { model.setInput(0, featuresLabels.getFeatures()); model.setLabels(getLabelsFromFeaturesLabels(featuresLabels)); model.computeGradientAndScore(); } }
ComputationGraphHandler implements INetworkHandler { @Override public void performGradientsComputation(FeaturesLabels featuresLabels) { model.setInput(0, featuresLabels.getFeatures()); model.setLabels(getLabelsFromFeaturesLabels(featuresLabels)); model.computeGradientAndScore(); } ComputationGraphHandler(ComputationGraph model, String[] labelNames, String gradientName); }
ComputationGraphHandler implements INetworkHandler { @Override public void performGradientsComputation(FeaturesLabels featuresLabels) { model.setInput(0, featuresLabels.getFeatures()); model.setLabels(getLabelsFromFeaturesLabels(featuresLabels)); model.computeGradientAndScore(); } ComputationGraphHandler(ComputationGraph model, String[] labelNames, String gradientName); @Override void notifyGradientCalculation(); @Override void notifyIterationDone(); @Override void performFit(FeaturesLabels featuresLabels); @Override void performGradientsComputation(FeaturesLabels featuresLabels); @Override void fillGradientsResponse(Gradients gradients); @Override void applyGradient(Gradients gradients, long batchSize); @Override INDArray[] recurrentStepOutput(Observation observation); @Override INDArray[] batchOutput(INDArray batch); @Override void resetState(); @Override INetworkHandler clone(); @Override void copyFrom(INetworkHandler from); }
ComputationGraphHandler implements INetworkHandler { @Override public void performGradientsComputation(FeaturesLabels featuresLabels) { model.setInput(0, featuresLabels.getFeatures()); model.setLabels(getLabelsFromFeaturesLabels(featuresLabels)); model.computeGradientAndScore(); } ComputationGraphHandler(ComputationGraph model, String[] labelNames, String gradientName); @Override void notifyGradientCalculation(); @Override void notifyIterationDone(); @Override void performFit(FeaturesLabels featuresLabels); @Override void performGradientsComputation(FeaturesLabels featuresLabels); @Override void fillGradientsResponse(Gradients gradients); @Override void applyGradient(Gradients gradients, long batchSize); @Override INDArray[] recurrentStepOutput(Observation observation); @Override INDArray[] batchOutput(INDArray batch); @Override void resetState(); @Override INetworkHandler clone(); @Override void copyFrom(INetworkHandler from);  }