Loading...
Searching...
No Matches
Classes |
Public Types |
Public Member Functions |
Public Attributes |
Protected Types |
Protected Member Functions |
Static Protected Member Functions |
Protected Attributes |
Static Protected Attributes |
List of all members
opennn::Optimizer Class Reference
#include <opennn/training/optimizer.h>
Inheritance diagram for opennn::Optimizer:
Classes | |
| struct | BestModelSnapshot |
| struct | EpochReport |
| struct | FullBatchContext |
| struct | FullBatchHooks |
| struct | FullBatchStep |
| struct | TrainingSession |
Public Types | |
| using | StoppingCondition = opennn::StoppingCondition |
Public Member Functions | |
| Optimizer (Loss *=nullptr) | |
| virtual | ~Optimizer () |
| const Loss * | get_loss () const noexcept |
| bool | get_display () const noexcept |
| void | set (Loss *new_loss) |
| virtual void | set_display (bool new_display) |
| void | set_display_period (const Index new_display_period) |
| void | set_workers_number (int new_workers_number) |
| void | set_cuda_graph (bool enabled) |
| bool | get_cuda_graph_capture_failed () const noexcept |
| void | set_shuffle (bool enabled) |
| void | set_batch_pool_size (int size) |
| void | set_maximum_epochs (const Index new_maximum_epochs) |
| Index | get_maximum_epochs () const noexcept |
| void | set_maximum_time (const float new_maximum_time) |
| void | set_loss_goal (const float new_loss_goal) |
| void | set_maximum_validation_failures (const Index new_maximum_validation_failures) |
| void | set_validation_period (const Index n) |
| void | set_restore_best (bool enabled) |
| void | set_gradient_clip_norm (const float new_clip) |
| void | set_joint_gradient_arena (bool enabled) noexcept |
| Index | get_batch_size () const noexcept |
| void | set_batch_size (const Index new_batch_size) |
| virtual void | configure_for_task (NetworkTask) |
| virtual TrainingResult | train () |
| Index | get_maximum_batch_size () const |
| const string & | get_name () const noexcept |
| virtual void | from_JSON (const JsonDocument &) |
| virtual void | to_JSON (JsonWriter &) const |
| void | save (const filesystem::path &) const |
| void | load (const filesystem::path &) |
Public Attributes | |
| function< void(Index, float, float, Network *)> | post_epoch_callback |
| function< void(Network *)> | post_batch_callback |
| function< void(Index, float)> | post_best_callback |
Protected Types | |
| enum class | UpdateMode { Standard , Capturable } |
Protected Member Functions | |
| void | set_names () |
| void | prepare_training_artifacts () |
| Index | get_epoch_budget () const noexcept |
| optional< StoppingCondition > | find_stopping_condition (const EpochReport &, float minimum_loss_decrease=-MAX) const |
| void | close_training_result (TrainingResult &, const EpochReport &, bool has_validation) const |
| void | update_best_parameters (Network *, float, Index, Index &, BestModelSnapshot &) |
| void | restore_best_parameters (Network *, TrainingResult &, const BestModelSnapshot &) |
| void | write_common_json (JsonWriter &) const |
| void | read_common_json (const Json *) |
| void | setup_device_training () |
| void | teardown_device_training () |
| void | warmup_device_training (TrainingContext &, ThreadSafeQueue< Batch * > &, const vector< vector< Index > > &, const FeatureSelection &, TrainingSession &, OptimizerData &, ForwardPropagation *validation_forward_propagation=nullptr, ThreadSafeQueue< Batch * > *validation_empty_queue=nullptr, const vector< vector< Index > > *validation_batches=nullptr) |
| void | prefetch_batch (Batch &) |
| void | sync_device (bool on_gpu, bool has_recurrent_layers, TrainingSession &) |
| bool | should_display (Index epoch) const noexcept |
| void | display_epoch_results (Index epoch, float training_error, float training_accuracy, float validation_error, float validation_accuracy, bool has_validation, bool validation_fresh, bool is_token_cross_entropy, float elapsed_time) const |
| void | setup_batch_pools (BatchPools &pools, Dataset &dataset, Network &network, Index training_batch_size, Index validation_batch_size, bool has_validation, TrainingSession &training_session) |
| unique_ptr< BatchPrefetchSession > | start_batch_prefetch (ThreadSafeQueue< Batch * > &, const vector< vector< Index > > &, const FeatureSelection &, FillMode, WorkerProfileCounters *profile_counters=nullptr) |
| int | get_batch_pool_size (const Network &) const |
| Loss::EvaluationResult | run_epoch_loop (EpochLoopContext &) |
| void | prepare_full_batch_training (FullBatchContext &, const char *banner) |
| TrainingResult | train_full_batch (FullBatchContext &, const FullBatchHooks &) |
| virtual string | get_display_name () const |
| virtual void | setup_optimizer_data (OptimizerData &, Index, Device) |
| virtual void | update_parameters (BackPropagation &, OptimizerData &, UpdateMode=UpdateMode::Standard) |
| virtual bool | supports_cuda_graph () const noexcept |
| bool | network_has_active_dropout () const |
| bool | can_use_cuda_graph () const |
| virtual void | on_epoch_begin (Index, OptimizerData &) |
| bool | uses_joint_gradient_arena () const noexcept |
| Loss::EvaluationResult | run_graph_epoch (TrainingSession &, OptimizerData &, ForwardPropagation &, BackPropagation &, ThreadSafeQueue< Batch * > &, const vector< vector< Index > > &, const FeatureSelection &) |
| Loss::EvaluationResult | train_epoch (TrainingContext &, ThreadSafeQueue< Batch * > &, const vector< vector< Index > > &, const FeatureSelection &, TrainingSession &, OptimizerData &) |
| Loss::EvaluationResult | evaluate_epoch (ForwardPropagation &, ThreadSafeQueue< Batch * > &, const vector< vector< Index > > &, const FeatureSelection &, TrainingSession &) |
Static Protected Member Functions | |
| static void | clip_gradient_norm (BackPropagation &, float) |
Protected Attributes | |
| Loss * | loss = nullptr |
| float | training_loss_goal = 0.0f |
| Index | maximum_validation_failures = numeric_limits<Index>::max() |
| Index | validation_period = 1 |
| float | gradient_clip_norm = 0.0f |
| bool | joint_gradient_arena = false |
| bool | restore_best = true |
| Index | maximum_epochs = 10000 |
| Index | batch_size = 0 |
| float | maximum_time = 360000.0f |
| Index | display_period = 10 |
| bool | display = true |
| bool | shuffle_samples = true |
| int | batch_pool_size_override = 0 |
| int | workers_number = default_workers_number |
| bool | use_cuda_graph = false |
| bool | cuda_graph_capture_failed = false |
| string | name |
Static Protected Attributes | |
| static const int | default_workers_number |
Member Typedef Documentation
◆ StoppingCondition
Member Enumeration Documentation
◆ UpdateMode
|
strongprotected |
Constructor & Destructor Documentation
◆ Optimizer()
|
explicit |
◆ ~Optimizer()
|
virtual |
Member Function Documentation
◆ can_use_cuda_graph()
|
inlineprotected |
◆ clip_gradient_norm()
|
staticprotected |
◆ close_training_result()
|
protected |
◆ configure_for_task()
|
virtual |
Reimplemented in opennn::Adam.
◆ display_epoch_results()
|
protected |
◆ evaluate_epoch()
|
protected |
◆ find_stopping_condition()
|
protected |
◆ from_JSON()
|
virtual |
Reimplemented in opennn::Adam, opennn::LevenbergMarquardt, opennn::QuasiNewton, and opennn::SGD.
◆ get_batch_pool_size()
|
protected |
◆ get_batch_size()
|
inlinenoexcept |
◆ get_cuda_graph_capture_failed()
|
inlinenoexcept |
◆ get_display()
|
inlinenoexcept |
◆ get_display_name()
|
inlineprotectedvirtual |
◆ get_epoch_budget()
|
inlineprotectednoexcept |
◆ get_loss()
|
inlinenoexcept |
◆ get_maximum_batch_size()
| Index opennn::Optimizer::get_maximum_batch_size | ( | ) | const |
◆ get_maximum_epochs()
|
inlinenoexcept |
◆ get_name()
|
inlinenoexcept |
◆ load()
| void opennn::Optimizer::load | ( | const filesystem::path & | ) |
◆ network_has_active_dropout()
|
protected |
◆ on_epoch_begin()
|
inlineprotectedvirtual |
Reimplemented in opennn::Adam.
◆ prefetch_batch()
|
protected |
◆ prepare_full_batch_training()
|
protected |
◆ prepare_training_artifacts()
|
protected |
◆ read_common_json()
|
protected |
◆ restore_best_parameters()
|
protected |
◆ run_epoch_loop()
|
protected |
◆ run_graph_epoch()
|
protected |
◆ save()
| void opennn::Optimizer::save | ( | const filesystem::path & | ) | const |
◆ set()
|
inline |
◆ set_batch_pool_size()
|
inline |
◆ set_batch_size()
|
inline |
◆ set_cuda_graph()
|
inline |
◆ set_display()
|
inlinevirtual |
◆ set_display_period()
|
inline |
◆ set_gradient_clip_norm()
|
inline |
◆ set_joint_gradient_arena()
|
inlinenoexcept |
◆ set_loss_goal()
|
inline |
◆ set_maximum_epochs()
|
inline |
◆ set_maximum_time()
|
inline |
◆ set_maximum_validation_failures()
|
inline |
◆ set_names()
|
protected |
◆ set_restore_best()
|
inline |
◆ set_shuffle()
|
inline |
◆ set_validation_period()
|
inline |
◆ set_workers_number()
|
inline |
◆ setup_batch_pools()
|
protected |
◆ setup_device_training()
|
protected |
◆ setup_optimizer_data()
|
inlineprotectedvirtual |
◆ should_display()
|
inlineprotectednoexcept |
◆ start_batch_prefetch()
|
protected |
◆ supports_cuda_graph()
|
inlineprotectedvirtualnoexcept |
◆ sync_device()
|
protected |
◆ teardown_device_training()
|
protected |
◆ to_JSON()
|
virtual |
Reimplemented in opennn::Adam, opennn::LevenbergMarquardt, opennn::QuasiNewton, and opennn::SGD.
◆ train()
|
virtual |
Reimplemented in opennn::LevenbergMarquardt, and opennn::QuasiNewton.
◆ train_epoch()
|
protected |
◆ train_full_batch()
|
protected |
◆ update_best_parameters()
|
protected |
◆ update_parameters()
|
inlineprotectedvirtual |
Reimplemented in opennn::Adam, and opennn::SGD.
◆ uses_joint_gradient_arena()
|
protectednoexcept |
◆ warmup_device_training()
|
protected |
◆ write_common_json()
|
protected |
Member Data Documentation
◆ batch_pool_size_override
|
protected |
◆ batch_size
|
protected |
◆ cuda_graph_capture_failed
|
protected |
◆ default_workers_number
|
staticprotected |
◆ display
|
protected |
◆ display_period
|
protected |
◆ gradient_clip_norm
|
protected |
◆ joint_gradient_arena
|
protected |
◆ loss
|
protected |
◆ maximum_epochs
|
protected |
◆ maximum_time
|
protected |
◆ maximum_validation_failures
|
protected |
◆ name
|
protected |
◆ post_batch_callback
| function<void(Network*)> opennn::Optimizer::post_batch_callback |
◆ post_best_callback
| function<void(Index, float)> opennn::Optimizer::post_best_callback |
◆ post_epoch_callback
| function<void(Index, float, float, Network*)> opennn::Optimizer::post_epoch_callback |
◆ restore_best
|
protected |
◆ shuffle_samples
|
protected |
◆ training_loss_goal
|
protected |
◆ use_cuda_graph
|
protected |
◆ validation_period
|
protected |
◆ workers_number
|
protected |