Skip to content

Commit 1475415

Browse files
committed
some mostly whitespace-related fixes relating to online-nnet3 decoding (should make no difference to anything)
1 parent 6bd89df commit 1475415

4 files changed

Lines changed: 24 additions & 25 deletions

File tree

src/nnet3/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ OBJFILES = nnet-common.o nnet-compile.o nnet-component-itf.o \
2525
nnet-diagnostics.o nnet-combine.o nnet-am-decodable-simple.o \
2626
nnet-optimize-utils.o nnet-chain-example.o \
2727
nnet-chain-training.o nnet-chain-diagnostics.o nnet-chain-combine.o \
28-
discriminative-supervision.o nnet-discriminative-example.o \
29-
nnet-discriminative-diagnostics.o \
30-
discriminative-training.o nnet-discriminative-training.o \
31-
online-nnet3-decodable-simple.o
28+
discriminative-supervision.o nnet-discriminative-example.o \
29+
nnet-discriminative-diagnostics.o \
30+
discriminative-training.o nnet-discriminative-training.o \
31+
online-nnet3-decodable-simple.o
3232

3333

3434
LIBNAME = kaldi-nnet3

src/nnet3/online-nnet3-decodable-simple.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ int32 DecodableNnet3SimpleOnline::NumSubsampledFrames(int32 num_frames) const {
8383

8484
void DecodableNnet3SimpleOnline::ComputeForFrame(int32 subsampled_frame) {
8585
int32 features_ready = features_->NumFramesReady();
86-
bool input_finished = features_->IsLastFrame(features_ready - 1);
86+
bool input_finished = features_->IsLastFrame(features_ready - 1);
8787
KALDI_ASSERT(subsampled_frame >= 0);
8888
if (subsampled_frame >= begin_frame_ &&
8989
subsampled_frame < begin_frame_ + scaled_loglikes_.NumRows())
@@ -121,23 +121,23 @@ void DecodableNnet3SimpleOnline::ComputeForFrame(int32 subsampled_frame) {
121121
int32 num_subsampled_frames = NumSubsampledFrames(input_frame_end - input_frame_begin -
122122
left_context_ - right_context_);
123123
// I'm not checking if the input feature vector is ok.
124-
// It should be done, but I'm not sure if it is the best place.
124+
// It should be done, but I'm not sure if it is the best place.
125125
// Maybe a new "nnet3 feature pipeline"?
126126
int32 mfcc_dim = am_nnet_.GetNnet().InputDim("input");
127127
int32 ivector_dim = am_nnet_.GetNnet().InputDim("ivector");
128128
// MFCCs in the left chunk
129129
SubMatrix<BaseFloat> mfcc_mat(features.ColRange(0, mfcc_dim));
130-
130+
131131
Vector<BaseFloat> input_ivector;
132132
if(ivector_dim != -1){
133133
// iVectors in the right chunk
134134
KALDI_ASSERT(features.NumCols() == mfcc_dim + ivector_dim && "Mismatch in features dim");
135135
SubMatrix<BaseFloat> ivector_mat(features.ColRange(mfcc_dim, ivector_dim));
136136
// Get last ivector... not sure if GetCurrentIvector is needed in the online context
137137
// I think it should work fine just getting the last row for testing
138-
input_ivector = ivector_mat.Row(ivector_mat.NumRows() - 1);
138+
input_ivector = ivector_mat.Row(ivector_mat.NumRows() - 1);
139139
}
140-
140+
141141
DoNnetComputation(input_frame_begin,
142142
mfcc_mat, input_ivector, subsampled_frame * subsample, num_subsampled_frames);
143143

src/nnet3/online-nnet3-decodable-simple.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct DecodableNnet3OnlineOptions {
4343
int32 max_nnet_batch_size;
4444
NnetComputeOptions compute_config;
4545
NnetOptimizeOptions optimize_config;
46-
46+
4747
DecodableNnet3OnlineOptions():
4848
frame_subsampling_factor(1),
4949
acoustic_scale(0.1),
@@ -73,7 +73,7 @@ struct DecodableNnet3OnlineOptions {
7373
// register the compute options with the prefix "computation".
7474
ParseOptions compute_opts("computation", opts);
7575
compute_config.Register(&compute_opts);
76-
76+
7777
}
7878
};
7979

@@ -87,29 +87,29 @@ struct DecodableNnet3OnlineOptions {
8787
class DecodableNnet3SimpleOnline: public DecodableInterface {
8888
public:
8989
DecodableNnet3SimpleOnline(const AmNnetSimple &am_nnet,
90-
const TransitionModel &trans_model,
91-
const DecodableNnet3OnlineOptions &opts,
92-
OnlineFeatureInterface *input_feats);
93-
94-
90+
const TransitionModel &trans_model,
91+
const DecodableNnet3OnlineOptions &opts,
92+
OnlineFeatureInterface *input_feats);
93+
94+
9595
/// Returns the scaled log likelihood
9696
virtual BaseFloat LogLikelihood(int32 frame, int32 index);
97-
97+
9898
virtual bool IsLastFrame(int32 frame) const;
9999

100-
virtual int32 NumFramesReady() const;
101-
100+
virtual int32 NumFramesReady() const;
101+
102102
/// Indices are one-based! This is for compatibility with OpenFst.
103103
virtual int32 NumIndices() const { return trans_model_.NumTransitionIds(); }
104-
104+
105105
private:
106106

107107
/// If the neural-network outputs for this frame are not cached, it computes
108108
/// them (and possibly for some succeeding frames)
109109
void ComputeForFrame(int32 frame);
110110
// corrects number of frames by frame_subsampling_factor;
111111
int32 NumSubsampledFrames(int32) const;
112-
112+
113113
void DoNnetComputation(
114114
int32 input_t_start,
115115
const MatrixBase<BaseFloat> &input_feats,
@@ -129,11 +129,11 @@ class DecodableNnet3SimpleOnline: public DecodableInterface {
129129
int32 right_context_; // Right context of the network (cached here)
130130
int32 num_pdfs_; // Number of pdfs, equals output-dim of the network (cached
131131
// here)
132-
132+
133133
int32 begin_frame_; // First frame for which scaled_loglikes_ is valid
134134
// (i.e. the first frame of the batch of frames for
135135
// which we've computed the output).
136-
136+
137137
// scaled_loglikes_ contains the neural network pseudo-likelihoods: the log of
138138
// (prob divided by the prior), scaled by opts.acoustic_scale). We may
139139
// compute this using the GPU, but we transfer it back to the system memory

src/online2bin/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ OBJFILES =
1818
TESTFILES =
1919

2020
ADDLIBS = ../online2/kaldi-online2.a ../ivector/kaldi-ivector.a \
21-
../nnet2/kaldi-nnet2.a ../lat/kaldi-lat.a \
21+
../nnet2/kaldi-nnet2.a ../nnet3/kaldi-nnet3.a ../lat/kaldi-lat.a \
2222
../decoder/kaldi-decoder.a ../cudamatrix/kaldi-cudamatrix.a \
2323
../feat/kaldi-feat.a ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a \
2424
../hmm/kaldi-hmm.a ../tree/kaldi-tree.a \
2525
../matrix/kaldi-matrix.a ../fstext/kaldi-fstext.a \
2626
../util/kaldi-util.a ../thread/kaldi-thread.a ../base/kaldi-base.a \
27-
../nnet3/kaldi-nnet3.a
2827

2928
include ../makefiles/default_rules.mk

0 commit comments

Comments
 (0)