#include <evaluator.h>
Inherits cpid::Trainer.
Inherited by cpid::Evaluator::make_shared_enabler.
|
EpisodeHandle | startEpisode () override |
| Returns true if succeeded to register an episode, and false otherwise. More...
|
|
void | forceStopEpisode (EpisodeHandle const &) override |
|
bool | update () override |
|
virtual ag::Variant | forward (ag::Variant inp, EpisodeHandle const &) override |
|
void | reset () override |
| Releases all the worker threads so that they can be joined. More...
|
|
std::shared_ptr< ReplayBufferFrame > | makeFrame (ag::Variant, ag::Variant, float reward) override |
|
| Trainer (ag::Container model, ag::Optimizer optim, std::unique_ptr< BaseSampler >, std::unique_ptr< AsyncBatcher > batcher=nullptr) |
|
ag::Variant | forwardUnbatched (ag::Variant in, ag::Container model=nullptr) |
| Convenience function when one need to forward a single input. More...
|
|
virtual | ~Trainer ()=default |
|
void | setTrain (bool=true) |
|
bool | isTrain () const |
|
ag::Variant | sample (ag::Variant in) |
| Sample using the class' sampler. More...
|
|
ag::Container | model () const |
|
ag::Optimizer | optim () const |
|
ReplayBuffer & | replayBuffer () |
|
virtual std::shared_ptr< Evaluator > | makeEvaluator (size_t, std::unique_ptr< BaseSampler > sampler) |
|
void | setDone (bool=true) |
|
bool | isDone () const |
|
virtual void | step (EpisodeHandle const &, std::shared_ptr< ReplayBufferFrame > v, bool isDone=false) |
|
bool | isActive (EpisodeHandle const &) |
|
template<class Archive > |
void | save (Archive &ar) const |
|
template<class Archive > |
void | load (Archive &ar) |
|
template<typename T > |
bool | is () const |
|
Trainer & | setMetricsContext (std::shared_ptr< MetricsContext > context) |
|
std::shared_ptr< MetricsContext > | metricsContext () const |
|
| TORCH_ARG (float, noiseStd) |
|
| TORCH_ARG (bool, continuousActions) |
|
void | setBatcher (std::unique_ptr< AsyncBatcher > batcher) |
|
cpid::Evaluator::Evaluator |
( |
ag::Container |
model, |
|
|
std::unique_ptr< BaseSampler > |
sampler, |
|
|
size_t |
batchSize, |
|
|
ForwardFunction |
func |
|
) |
| |
|
protected |
void cpid::Evaluator::forceStopEpisode |
( |
EpisodeHandle const & |
handle | ) |
|
|
overridevirtual |
ag::Variant cpid::Evaluator::forward |
( |
ag::Variant |
inp, |
|
|
EpisodeHandle const & |
handle |
|
) |
| |
|
overridevirtual |
std::shared_ptr< ReplayBufferFrame > cpid::Evaluator::makeFrame |
( |
ag::Variant |
, |
|
|
ag::Variant |
, |
|
|
float |
reward |
|
) |
| |
|
overridevirtual |
void cpid::Evaluator::reset |
( |
| ) |
|
|
overridevirtual |
Releases all the worker threads so that they can be joined.
For the off-policy trainers, labels all games as inactive. For the on-policy trainers, additionally un-blocks all threads that could be waiting at the batch barrier.
Reimplemented from cpid::Trainer.
Returns true if succeeded to register an episode, and false otherwise.
After receiving false, a worker thread should check stopping conditins and re-try.
Reimplemented from cpid::Trainer.
bool cpid::Evaluator::update |
( |
| ) |
|
|
overridevirtual |
std::condition_variable cpid::Evaluator::batchBarrier_ |
|
protected |
size_t cpid::Evaluator::batchSize_ |
|
protected |
size_t cpid::Evaluator::gamesStarted_ = 0 |
|
protected |
std::shared_timed_mutex cpid::Evaluator::insertionMutex_ |
|
protected |
std::mutex cpid::Evaluator::updateMutex_ |
|
protected |
The documentation for this class was generated from the following files: