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