From 0ed4fae042443f4845a686af8f22f2504393844d Mon Sep 17 00:00:00 2001
From: NAUD Maxence <maxence.naud@cea.fr>
Date: Tue, 27 Feb 2024 09:29:24 +0000
Subject: [PATCH] [Add] ConstantLR and StepLR

---
 .../aidge/optimizer/LR/LRSchedulerList.hpp    | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 include/aidge/optimizer/LR/LRSchedulerList.hpp

diff --git a/include/aidge/optimizer/LR/LRSchedulerList.hpp b/include/aidge/optimizer/LR/LRSchedulerList.hpp
new file mode 100644
index 000000000..f89bd3070
--- /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
-- 
GitLab