Loading...
Searching...
No Matches
opennn::Adam Class Referencefinal
#include <opennn/training/adam.h>
Inheritance diagram for opennn::Adam:
Public Types | |
| enum | DataSlot { GradientMoment , SquareGradientMoment , GraphScalars } |
Public Types inherited from opennn::Optimizer | |
| using | StoppingCondition = opennn::StoppingCondition |
Public Member Functions | |
| Adam (Loss *=nullptr) | |
| void | configure_for_task (NetworkTask) override |
| void | set_learning_rate (const float new_learning_rate) |
| float | get_learning_rate () const |
| void | set_beta_1 (const float) |
| void | set_beta_2 (const float) |
| void | set_epsilon (float) |
| float | get_epsilon () const noexcept |
| void | set_bf16_first_moment (const bool enabled) |
| bool | get_bf16_first_moment () const noexcept |
| void | update_parameters (BackPropagation &, OptimizerData &, UpdateMode=UpdateMode::Standard) override |
| void | on_epoch_begin (Index, OptimizerData &) override |
| void | from_JSON (const JsonDocument &) override |
| void | to_JSON (JsonWriter &) const override |
Public Member Functions inherited from opennn::Optimizer | |
| 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 TrainingResult | train () |
| Index | get_maximum_batch_size () const |
| const string & | get_name () const noexcept |
| void | save (const filesystem::path &) const |
| void | load (const filesystem::path &) |
Additional Inherited Members | |
Public Attributes inherited from opennn::Optimizer | |
| function< void(Index, float, float, Network *)> | post_epoch_callback |
| function< void(Network *)> | post_batch_callback |
| function< void(Index, float)> | post_best_callback |
Protected Types inherited from opennn::Optimizer | |
| enum class | UpdateMode { Standard , Capturable } |
Protected Member Functions inherited from opennn::Optimizer | |
| 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 &) |
| bool | network_has_active_dropout () const |
| bool | can_use_cuda_graph () const |
| 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 inherited from opennn::Optimizer | |
| static void | clip_gradient_norm (BackPropagation &, float) |
Protected Attributes inherited from opennn::Optimizer | |
| 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 inherited from opennn::Optimizer | |
| static const int | default_workers_number |
Member Enumeration Documentation
◆ DataSlot
Constructor & Destructor Documentation
◆ Adam()
|
explicit |
Member Function Documentation
◆ configure_for_task()
|
overridevirtual |
Reimplemented from opennn::Optimizer.
◆ from_JSON()
|
overridevirtual |
Reimplemented from opennn::Optimizer.
◆ get_bf16_first_moment()
|
inlinenoexcept |
◆ get_epsilon()
|
inlinenoexcept |
◆ get_learning_rate()
|
inline |
◆ on_epoch_begin()
|
overridevirtual |
Reimplemented from opennn::Optimizer.
◆ set_beta_1()
| void opennn::Adam::set_beta_1 | ( | const float | ) |
◆ set_beta_2()
| void opennn::Adam::set_beta_2 | ( | const float | ) |
◆ set_bf16_first_moment()
|
inline |
◆ set_epsilon()
| void opennn::Adam::set_epsilon | ( | float | ) |
◆ set_learning_rate()
|
inline |
◆ to_JSON()
|
overridevirtual |
Reimplemented from opennn::Optimizer.
◆ update_parameters()
|
overridevirtual |
Reimplemented from opennn::Optimizer.
Public Types inherited from