@Test public void when_callingClone_expect_handlersAreCloned() throws Exception { setup(false); when(handler1.clone()).thenReturn(handler1); when(handler2.clone()).thenReturn(handler2); CompoundNetworkHandler result = (CompoundNetworkHandler)sut.clone(); assertNotSame(sut, result); verify(handler1, times(1)).clone(); verify(handler2, times(1)).clone(); }
@Override public INetworkHandler clone() { INetworkHandler[] clonedHandlers = new INetworkHandler[networkHandlers.length]; for(int i = 0; i < networkHandlers.length; ++i) { clonedHandlers[i] = networkHandlers[i].clone(); } return new CompoundNetworkHandler(clonedHandlers); }
CompoundNetworkHandler implements INetworkHandler { @Override public INetworkHandler clone() { INetworkHandler[] clonedHandlers = new INetworkHandler[networkHandlers.length]; for(int i = 0; i < networkHandlers.length; ++i) { clonedHandlers[i] = networkHandlers[i].clone(); } return new CompoundNetworkHandler(clonedHandlers); } }
CompoundNetworkHandler implements INetworkHandler { @Override public INetworkHandler clone() { INetworkHandler[] clonedHandlers = new INetworkHandler[networkHandlers.length]; for(int i = 0; i < networkHandlers.length; ++i) { clonedHandlers[i] = networkHandlers[i].clone(); } return new CompoundNetworkHandler(clonedHandlers); } CompoundNetworkHandler(INetworkHandler... networkHandlers); }
CompoundNetworkHandler implements INetworkHandler { @Override public INetworkHandler clone() { INetworkHandler[] clonedHandlers = new INetworkHandler[networkHandlers.length]; for(int i = 0; i < networkHandlers.length; ++i) { clonedHandlers[i] = networkHandlers[i].clone(); } return new CompoundNetworkHandler(clonedHandlers); } CompoundNetworkHandler(INetworkHandler... networkHandlers); @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); }
CompoundNetworkHandler implements INetworkHandler { @Override public INetworkHandler clone() { INetworkHandler[] clonedHandlers = new INetworkHandler[networkHandlers.length]; for(int i = 0; i < networkHandlers.length; ++i) { clonedHandlers[i] = networkHandlers[i].clone(); } return new CompoundNetworkHandler(clonedHandlers); } CompoundNetworkHandler(INetworkHandler... networkHandlers); @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);  }