Last active
March 6, 2017 21:31
-
-
Save arunreddy/f3bcd2709788b4bdf6c9b2570b26d5db to your computer and use it in GitHub Desktop.
policy_class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SGD with variadic templates for policy type class. | |
template<typename DecomposableFunctionType, typename ... PolicyType> | |
class SGD{ | |
} | |
// Use alias to declare most frequently used combinations. | |
using StandardSGD = SGD<FunctionType, EmptyUpdate, NoDecay>; | |
using SGD2 = SGD<FunctionType, MomentumUpdate, NoDecay>; | |
using SGD3 = SGD<FunctionType, NesterovUpdate, ExponentialDecay>; | |
// Is it ok to assume in the code that the Order of policy types is fixed. | |
// FunctionType at index 0, followed by UpdateType at 1 and DecayType at 2. | |
// (OR) a relaxed version.. | |
// Choose the policy based on the PolicyType, if not provided fall back to defaults. | |
using StandardSGD = SGD<FunctionType> // If not provided pick the default policy type. | |
using SGD2 = SGD<FunctionType, MomentumUpdate> // Use default NoDecay for DecayType | |
using SGD3 = SGD<FunctionType, ExponentDecay> // Use default EmptyUpdate for UpdateType |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment