Skip to content
Snippets Groups Projects
Commit 0ed4fae0 authored by Maxence Naud's avatar Maxence Naud
Browse files

[Add] ConstantLR and StepLR

parent 8de2b659
No related branches found
No related tags found
No related merge requests found
/********************************************************************************
* 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment