15 #ifndef NLP_GRM2_BAUMWELCH_LOG_ADDER_H_ 16 #define NLP_GRM2_BAUMWELCH_LOG_ADDER_H_ 18 #include <type_traits> 20 #include <fst/float-weight.h> 21 #include <fst/weight.h> 28 template <
class Weight>
34 typename std::conditional_t<IsIdempotent<Weight>::value,
35 LogWeightTpl<typename Weight::ValueType>,
38 explicit LogAdder(Weight weight = Weight::Zero())
39 : sum_(
LogAdder<Weight>::To(weight)) {}
49 static const WeightConvert<Weight, HelperWeight> to;
54 static const WeightConvert<HelperWeight, Weight> from;
58 Adder<HelperWeight> sum_;
63 #endif // NLP_GRM2_BAUMWELCH_LOG_ADDER_H_ void Add(const Weight &weight)
LogAdder(Weight weight=Weight::Zero())
typename std::conditional_t< IsIdempotent< Weight >::value, LogWeightTpl< typename Weight::ValueType >, Weight > HelperWeight