@Test public void when_notifyNewEpochReturnsStop_expect_threadStopped() { mockTrainingContext(); mockTrainingListeners(true, false); thread.run(); assertEquals(0, thread.getEpochCount()); assertEquals(1, thread.getEpisodeCount()); assertEquals(0, thread.getStepCount()); }
@Override public void run() { RunContext context = new RunContext(); Nd4j.getAffinityManager().unsafeSetDevice(deviceNum); log.info("ThreadNum-" + threadNumber + " Started!"); while (!getAsyncGlobal().isTrainingComplete()) { if (episodeComplete) { startEpisode(context); } if(!startEpoch(context)) { break; } episodeComplete = handleTraining(context); if(!finishEpoch(context)) { break; } if(episodeComplete) { finishEpisode(context); } } }
AsyncThread extends Thread implements IEpochTrainer { @Override public void run() { RunContext context = new RunContext(); Nd4j.getAffinityManager().unsafeSetDevice(deviceNum); log.info("ThreadNum-" + threadNumber + " Started!"); while (!getAsyncGlobal().isTrainingComplete()) { if (episodeComplete) { startEpisode(context); } if(!startEpoch(context)) { break; } episodeComplete = handleTraining(context); if(!finishEpoch(context)) { break; } if(episodeComplete) { finishEpisode(context); } } } }
AsyncThread extends Thread implements IEpochTrainer { @Override public void run() { RunContext context = new RunContext(); Nd4j.getAffinityManager().unsafeSetDevice(deviceNum); log.info("ThreadNum-" + threadNumber + " Started!"); while (!getAsyncGlobal().isTrainingComplete()) { if (episodeComplete) { startEpisode(context); } if(!startEpoch(context)) { break; } episodeComplete = handleTraining(context); if(!finishEpoch(context)) { break; } if(episodeComplete) { finishEpisode(context); } } } AsyncThread(MDP<OBSERVATION, ACTION, ACTION_SPACE> mdp, TrainingListenerList listeners, int threadNumber, int deviceNum); }
AsyncThread extends Thread implements IEpochTrainer { @Override public void run() { RunContext context = new RunContext(); Nd4j.getAffinityManager().unsafeSetDevice(deviceNum); log.info("ThreadNum-" + threadNumber + " Started!"); while (!getAsyncGlobal().isTrainingComplete()) { if (episodeComplete) { startEpisode(context); } if(!startEpoch(context)) { break; } episodeComplete = handleTraining(context); if(!finishEpoch(context)) { break; } if(episodeComplete) { finishEpisode(context); } } } AsyncThread(MDP<OBSERVATION, ACTION, ACTION_SPACE> mdp, TrainingListenerList listeners, int threadNumber, int deviceNum); MDP<OBSERVATION, ACTION, ACTION_SPACE> getMdp(); void setHistoryProcessor(IHistoryProcessor.Configuration conf); void setHistoryProcessor(IHistoryProcessor historyProcessor); @Override void run(); void incrementSteps(); }
AsyncThread extends Thread implements IEpochTrainer { @Override public void run() { RunContext context = new RunContext(); Nd4j.getAffinityManager().unsafeSetDevice(deviceNum); log.info("ThreadNum-" + threadNumber + " Started!"); while (!getAsyncGlobal().isTrainingComplete()) { if (episodeComplete) { startEpisode(context); } if(!startEpoch(context)) { break; } episodeComplete = handleTraining(context); if(!finishEpoch(context)) { break; } if(episodeComplete) { finishEpisode(context); } } } AsyncThread(MDP<OBSERVATION, ACTION, ACTION_SPACE> mdp, TrainingListenerList listeners, int threadNumber, int deviceNum); MDP<OBSERVATION, ACTION, ACTION_SPACE> getMdp(); void setHistoryProcessor(IHistoryProcessor.Configuration conf); void setHistoryProcessor(IHistoryProcessor historyProcessor); @Override void run(); void incrementSteps();  }