arunreddy
3/6/2017 - 9:29 PM

policy_class

policy_class

// 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