diff --git a/include/aidge/aidge.hpp b/include/aidge/aidge.hpp index 6c4ca93ce28c0a8c769606f07b1badee676423fd..77371eddf15e4814217f973a0b2009a0ac31fbd6 100644 --- a/include/aidge/aidge.hpp +++ b/include/aidge/aidge.hpp @@ -62,7 +62,12 @@ #include "aidge/operator/Sqrt.hpp" #include "aidge/operator/Sub.hpp" #include "aidge/operator/Transpose.hpp" + +#include "aidge/optimizer/LR/LRSchedulerList.hpp" +#include "aidge/optimizer/LR/LRScheduler.hpp" + #include "aidge/scheduler/Scheduler.hpp" + #include "aidge/stimuli/Stimulus.hpp" #include "aidge/recipies/Recipies.hpp" diff --git a/include/aidge/optimizer/LR/LRSchedulerList.hpp b/include/aidge/optimizer/LR/LRSchedulerList.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f89bd307088e99f9ac53b3966a4211b09ce8c548 --- /dev/null +++ b/include/aidge/optimizer/LR/LRSchedulerList.hpp @@ -0,0 +1,34 @@ +/******************************************************************************** + * Copyright (c) 2023 CEA-List + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + ********************************************************************************/ + +#ifndef AIDGE_CORE_OPTIMIZER_LRSCHEDULERSLIST_H_ +#define AIDGE_CORE_OPTIMIZER_LRSCHEDULERSLIST_H_ + +#include "aidge/optimizer/LR/LRScheduler.hpp" + +#include <cstddef> // std::size_t + +namespace Aidge { + +LRScheduler ConstantLR(const float initialLR) { + return LRScheduler(initialLR); +} + + +LRScheduler StepLR(const float initialLR, const std::size_t stepSize, float gamma = 0.1f) { + return LRScheduler(initialLR, + [stepSize, gamma](float val, const std::size_t step) { + return (step % stepSize == 0) ? val*gamma : val; + }); +} +} // namespace Aidge + +#endif /* AIDGE_CORE_OPTIMIZER_LRSCHEDULERSLIST_H_ */ \ No newline at end of file