@@ -86,7 +86,7 @@ namespace k2 {
86
86
arcs in the output FSA.
87
87
88
88
89
- *The problem with differentability
89
+ *The problem with differentiability
90
90
91
91
Consider how to differentiate the weights of the output weighted FSA
92
92
w.r.t. those of the input. The problem with differentiability if we use the
@@ -113,7 +113,7 @@ namespace k2 {
113
113
114
114
*Different normalization
115
115
116
- Our form of "normalization" of this representation is differen too. The
116
+ Our form of "normalization" of this representation is different too. The
117
117
normalization is to make `symbol_sequence` as short as possible, and advance
118
118
`base_state` to compensate. For instance, if `symbol_sequence` is `a b c
119
119
d`, but the weighted subset of states we can reach by this symbol sequence
@@ -177,7 +177,7 @@ struct MaxTracebackState {
177
177
178
178
/* *
179
179
@param [in] state_id State in input FSA that this corresponds to
180
- @param [in] src Previous LogSumTracebackState that we'll point back
180
+ @param [in] src Previous MaxTracebackState that we'll point back
181
181
to, or NULL
182
182
@param [in] incoming_arc_index Arc-index in input FSA.
183
183
Its src_state will equal src->state_id,
@@ -213,7 +213,7 @@ class LogSumTracebackState;
213
213
/*
214
214
This struct is used inside LogSumTracebackState; it represents an
215
215
arc that traces back to a previous LogSumTracebackState.
216
- A LogSumTracebackState represents a weighted colletion of paths
216
+ A LogSumTracebackState represents a weighted collection of paths
217
217
terminating in a specific state.
218
218
*/
219
219
struct LogSumTracebackLink {
@@ -364,7 +364,7 @@ void TraceBack(std::unordered_set<LogSumTracebackState *> *cur_states,
364
364
// for LogSumTracebackState, above. This version is simpler.
365
365
void TraceBack (std::unordered_set<MaxTracebackState *> *cur_states,
366
366
int32_t num_steps,
367
- const float *, // arc_weights_in, unused.
367
+ const float *unused , // arc_weights_in, unused.
368
368
float *weight_out, std::vector<int32_t > *deriv_out);
369
369
370
370
template <class TracebackState >
@@ -633,7 +633,7 @@ void DetState<TracebackState>::Normalize(const WfsaWithFbWeights &wfsa_in,
633
633
std::unordered_set<TracebackState *> cur_states;
634
634
635
635
double fb_prob = -std::numeric_limits<double >::infinity ();
636
- for (auto p : elements) {
636
+ for (const auto & p : elements) {
637
637
TracebackState *state = p.second .get ();
638
638
fb_prob = LogSumOrMax<TracebackState>(
639
639
fb_prob,
@@ -701,19 +701,19 @@ class DetStateMap {
701
701
if (inserted) {
702
702
a->state_id = cur_output_state_++;
703
703
return true ;
704
- } else {
705
- a->state_id = p.first ->second ;
706
- return false ;
707
704
}
705
+
706
+ a->state_id = p.first ->second ;
707
+ return false ;
708
708
}
709
709
710
710
int32_t size () const { return cur_output_state_; }
711
711
712
712
private:
713
713
// simple hashing function that just takes the first element of the pair.
714
714
struct PairHasher {
715
- size_t operator ()(const std::pair<uint64_t , uint64_t > &p) const {
716
- return static_cast <size_t >(p.first );
715
+ std:: size_t operator ()(const std::pair<uint64_t , uint64_t > &p) const {
716
+ return static_cast <std:: size_t >(p.first );
717
717
}
718
718
};
719
719
@@ -781,7 +781,7 @@ class DetStateMap {
781
781
}
782
782
783
783
struct DetStateHasher {
784
- size_t operator ()(const std::pair<uint64_t , uint64_t > &p) const {
784
+ std:: size_t operator ()(const std::pair<uint64_t , uint64_t > &p) const {
785
785
return p.first ;
786
786
}
787
787
};
@@ -837,9 +837,9 @@ float DeterminizePrunedTpl(
837
837
arc_derivs_out->begin ());
838
838
if (!queue.empty ()) { // We stopped early due to max_step
839
839
return total_prob - queue.top ()->forward_backward_prob ;
840
- } else {
841
- return beam;
842
840
}
841
+
842
+ return beam;
843
843
}
844
844
} // namespace k2
845
845
0 commit comments