@Test public void when_callingClone_expect_handlerAndModelIsCloned() throws Exception { setup(false); when(modelMock.clone()).thenReturn(modelMock); ComputationGraphHandler result = (ComputationGraphHandler)sut.clone(); assertNotSame(sut, result); verify(modelMock, times(1)).clone(); Field privateField = ComputationGraphHandler.class.getDeclaredField("labelNames"); privateField.setAccessible(true); String[] cloneLabelNames = (String[])privateField.get(sut); assertArrayEquals(cloneLabelNames, LABEL_NAMES); privateField = ComputationGraphHandler.class.getDeclaredField("gradientName"); privateField.setAccessible(true); String cloneGradientName = (String)privateField.get(sut); assertEquals(cloneGradientName, GRADIENT_NAME); }
@Override public INetworkHandler clone() { return new ComputationGraphHandler(model.clone(), labelNames, gradientName); }
ComputationGraphHandler implements INetworkHandler { @Override public INetworkHandler clone() { return new ComputationGraphHandler(model.clone(), labelNames, gradientName); } }
ComputationGraphHandler implements INetworkHandler { @Override public INetworkHandler clone() { return new ComputationGraphHandler(model.clone(), labelNames, gradientName); } ComputationGraphHandler(ComputationGraph model, String[] labelNames, String gradientName); }
ComputationGraphHandler implements INetworkHandler { @Override public INetworkHandler clone() { return new ComputationGraphHandler(model.clone(), labelNames, gradientName); } 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 INetworkHandler clone() { return new ComputationGraphHandler(model.clone(), labelNames, gradientName); } 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);  }