Skip to content

Commit 8d8c5af

Browse files
committed
Fix style errors.
1 parent 0621b79 commit 8d8c5af

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

src/fstext/fstext-utils-inl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,8 +1141,8 @@ inline bool IsStochasticFst(const Fst<Arc> &fst,
11411141
NaturalLess<Weight> nl;
11421142
bool first_time = true;
11431143
bool ans = true;
1144-
if(min_sum) *min_sum = Arc::Weight::One();
1145-
if(max_sum) *max_sum = Arc::Weight::One();
1144+
if (min_sum) *min_sum = Arc::Weight::One();
1145+
if (max_sum) *max_sum = Arc::Weight::One();
11461146
for (StateIterator<Fst<Arc> > siter(fst); !siter.Done(); siter.Next()) {
11471147
StateId s = siter.Value();
11481148
Weight sum = fst.Final(s);
@@ -1179,8 +1179,8 @@ inline bool IsStochasticFst(const Fst<LogArc> &fst,
11791179
typedef Arc::Weight Weight;
11801180
bool first_time = true;
11811181
bool ans = true;
1182-
if(min_sum) *min_sum = LogArc::Weight::One();
1183-
if(max_sum) *max_sum = LogArc::Weight::One();
1182+
if (min_sum) *min_sum = LogArc::Weight::One();
1183+
if (max_sum) *max_sum = LogArc::Weight::One();
11841184
for (StateIterator<Fst<Arc> > siter(fst); !siter.Done(); siter.Next()) {
11851185
StateId s = siter.Value();
11861186
Weight sum = fst.Final(s);

src/ivectorbin/ivector-extractor-sum-accs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int main(int argc, char *argv[]) {
6060
}
6161
for (size_t i = 1; i < po.NumArgs(); i++) {
6262
bool b;
63-
if(kaldi::InitKaldiInputStream(inputs[i-1]->Stream(), &b)) {
63+
if (kaldi::InitKaldiInputStream(inputs[i-1]->Stream(), &b)) {
6464
bool add = true;
6565
stats.Read(inputs[i-1]->Stream(), b, add);
6666
delete inputs[i-1];

src/lat/push-lattice-test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ void TestPushCompactLatticeStrings() {
4444
for (CompactLatticeArc::StateId s = 0; s < clat2.NumStates(); s++) {
4545
if (s == 0)
4646
continue; // We don't check state zero, as the "leftover string" stays
47-
// there.
48-
// Double check: HMM state ID's cannot be negative.
47+
// there.
4948
int32 first_label = -1;
5049
bool ok = false;
5150
bool first_label_set = false;

src/matrix/kaldi-gpsr.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ double GpsrBasic(const GpsrConfig &opts, const SpMatrix<double> &H,
231231
num_zeros;
232232
bool keep_going = true;
233233

234-
KALDI_ASSERT(opts.max_iters_backtrak > 0 &&
234+
KALDI_ASSERT(opts.max_iters_backtrack > 0 &&
235235
"Gpsr must run at least one iteration of backtracking");
236236

237237
for (int32 iter = 0; keep_going; iter++) {
@@ -242,7 +242,7 @@ double GpsrBasic(const GpsrConfig &opts, const SpMatrix<double> &H,
242242
if (alpha > opts.alpha_max) alpha = opts.alpha_max;
243243

244244
// This is the backtracking line search part:
245-
for (int32 k = 0; k < opts.max_iters_backtrak; k++) {
245+
for (int32 k = 0; k < opts.max_iters_backtrack; k++) {
246246
// Calculate the potential new iterate: [z_k - \alpha_k \grad F(z_k)]_+
247247
u_new.CopyFromVec(u);
248248
u_new.AddVec(-alpha, grad_u);
@@ -271,7 +271,7 @@ double GpsrBasic(const GpsrConfig &opts, const SpMatrix<double> &H,
271271
else
272272
alpha *= opts.gpsr_beta;
273273

274-
if (k == opts.max_iters_backtrak - 1) { // Stop further optimization
274+
if (k == opts.max_iters_backtrack - 1) { // Stop further optimization
275275
KALDI_WARN << "Backtracking line search did not decrease objective.";
276276
u_new.CopyFromVec(u);
277277
u_new.ApplyFloor(0.0);

src/matrix/kaldi-gpsr.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct GpsrConfig {
6767
/// function must be less than the old one by mu times the gradient in the
6868
/// direction of the change in x. 0 < mu < 1
6969
double gpsr_mu;
70-
int32 max_iters_backtrak; ///< Max iterations for backtracking line search
70+
int32 max_iters_backtrack; ///< Max iterations for backtracking line search
7171

7272
bool debias; ///< Do debiasing, i.e. unconstrained optimization at the end
7373
double stop_thresh_debias; ///< Stopping threshold for debiasing stage
@@ -86,7 +86,7 @@ struct GpsrConfig {
8686

8787
gpsr_beta = 0.5;
8888
gpsr_mu = 0.1;
89-
max_iters_backtrak = 50;
89+
max_iters_backtrack = 50;
9090

9191
debias = false;
9292
stop_thresh_debias = 0.001;
@@ -120,7 +120,7 @@ inline void GpsrConfig::Register(OptionsItf *opts) {
120120
"Step size reduction factor in backtracking line search (0<beta<1).");
121121
opts->Register("gpsr-mu", &gpsr_mu, module+
122122
"Improvement factor in backtracking line search (0<mu<1).");
123-
opts->Register("max-iters-backtrack", &max_iters_backtrak, module+
123+
opts->Register("max-iters-backtrack", &max_iters_backtrack, module+
124124
"Maximum number of iterations of backtracking line search.");
125125

126126
opts->Register("debias", &debias, module+

src/matrix/matrix-lib-test.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,8 +2520,9 @@ template<typename Real> static void UnitTestIo() {
25202520
bool binary_in;
25212521
bool either_way = (i%2 == 0);
25222522
std::ifstream ins("tmpf", std::ios_base::in | std::ios_base::binary);
2523-
KALDI_ASSERT(InitKaldiInputStream(ins, &binary_in)
2524-
&& "Malformed input stream.");
2523+
if (!InitKaldiInputStream(ins, &binary_in)) {
2524+
KALDI_ERR << "Malformed input stream.";
2525+
}
25252526
N.Resize(0, 0);
25262527
T.Resize(0);
25272528
v2.Resize(0);
@@ -2586,8 +2587,9 @@ template<typename Real> static void UnitTestIoCross() { // across types.
25862587
{
25872588
std::ifstream ins("tmpf", std::ios_base::in | std::ios_base::binary);
25882589
bool binary_in;
2589-
KALDI_ASSERT(InitKaldiInputStream(ins, &binary_in)
2590-
&& "Malformed input stream");
2590+
if (!InitKaldiInputStream(ins, &binary_in)) {
2591+
KALDI_ERR << "Malformed input stream";
2592+
}
25912593

25922594
MO.Read(ins, binary_in);
25932595
SO.Read(ins, binary_in);

src/matrix/srfft.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ void SplitRadixComplexFft<Real>::BitReversePermute(Real *x, MatrixIndexT logn) c
210210
template<typename Real>
211211
void SplitRadixComplexFft<Real>::ComputeRecursive(Real *xr, Real *xi, MatrixIndexT logn) const {
212212

213-
// Do we required that logn <= this->logn_?
214213
MatrixIndexT m, m2, m4, m8, nel, n;
215214
Real *xr1, *xr2, *xi1, *xi2;
216215
Real *cn = nullptr, *spcn = nullptr, *smcn = nullptr, *c3n = nullptr,

src/sgmm2bin/sgmm2-sum-accs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int main(int argc, char *argv[]) {
5959
}
6060
for (size_t i = 0; i < po.NumArgs() - 1; i++) {
6161
bool b;
62-
if(kaldi::InitKaldiInputStream(inputs[i]->Stream(), &b)) {
62+
if (kaldi::InitKaldiInputStream(inputs[i]->Stream(), &b)) {
6363
transition_accs.Read(inputs[i]->Stream(), b, true /* add values */);
6464
sgmm_accs.Read(inputs[i]->Stream(), b, true /* add values */);
6565
delete inputs[i];

0 commit comments

Comments
 (0)