@Test public void when_callingClone_expect_handlerAndModelIsCloned() throws Exception { setup(false); when(modelMock.clone()).thenReturn(modelMock); MultiLayerNetworkHandler result = (MultiLayerNetworkHandler)sut.clone(); assertNotSame(sut, result); verify(modelMock, times(1)).clone(); Field privateField = MultiLayerNetworkHandler.class.getDeclaredField("labelName"); privateField.setAccessible(true); String cloneLabelNames = (String)privateField.get(sut); assertEquals(cloneLabelNames, LABEL_NAME); privateField = MultiLayerNetworkHandler.class.getDeclaredField("gradientName"); privateField.setAccessible(true); String cloneGradientName = (String)privateField.get(sut); assertEquals(cloneGradientName, GRADIENT_NAME); }
@Override public INetworkHandler clone() { return new MultiLayerNetworkHandler(model.clone(), labelName, gradientName); }
MultiLayerNetworkHandler implements INetworkHandler { @Override public INetworkHandler clone() { return new MultiLayerNetworkHandler(model.clone(), labelName, gradientName); } }
MultiLayerNetworkHandler implements INetworkHandler { @Override public INetworkHandler clone() { return new MultiLayerNetworkHandler(model.clone(), labelName, gradientName); } MultiLayerNetworkHandler(MultiLayerNetwork model, String labelName, String gradientName); }
MultiLayerNetworkHandler implements INetworkHandler { @Override public INetworkHandler clone() { return new MultiLayerNetworkHandler(model.clone(), labelName, gradientName); } MultiLayerNetworkHandler(MultiLayerNetwork model, String labelName, String gradientName); @Override void notifyGradientCalculation(); @Override void notifyIterationDone(); @Override void performFit(FeaturesLabels featuresLabels); @Override void performGradientsComputation(FeaturesLabels featuresLabels); @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); @Override void fillGradientsResponse(Gradients gradients); }
MultiLayerNetworkHandler implements INetworkHandler { @Override public INetworkHandler clone() { return new MultiLayerNetworkHandler(model.clone(), labelName, gradientName); } MultiLayerNetworkHandler(MultiLayerNetwork model, String labelName, String gradientName); @Override void notifyGradientCalculation(); @Override void notifyIterationDone(); @Override void performFit(FeaturesLabels featuresLabels); @Override void performGradientsComputation(FeaturesLabels featuresLabels); @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); @Override void fillGradientsResponse(Gradients gradients);  }