NnetSimpleComputationOptions Struct Reference

#include <nnet-am-decodable-simple.h>

Inheritance diagram for NnetSimpleComputationOptions:
Collaboration diagram for NnetSimpleComputationOptions:

Public Member Functions

 NnetSimpleComputationOptions ()
 
void Register (OptionsItf *opts)
 
void CheckAndFixConfigs (int32 nnet_modulus)
 

Public Attributes

int32 extra_left_context
 
int32 extra_right_context
 
int32 extra_left_context_initial
 
int32 extra_right_context_final
 
int32 frame_subsampling_factor
 
int32 frames_per_chunk
 
BaseFloat acoustic_scale
 
bool debug_computation
 
NnetOptimizeOptions optimize_config
 
NnetComputeOptions compute_config
 
CachingOptimizingCompilerOptions compiler_config
 

Detailed Description

Definition at line 43 of file nnet-am-decodable-simple.h.

Constructor & Destructor Documentation

◆ NnetSimpleComputationOptions()

Definition at line 56 of file nnet-am-decodable-simple.h.

References CachingOptimizingCompilerOptions::cache_capacity, and NnetSimpleComputationOptions::frames_per_chunk.

56  :
62  frames_per_chunk(50),
63  acoustic_scale(0.1),
64  debug_computation(false) {
66  }
CachingOptimizingCompilerOptions compiler_config

Member Function Documentation

◆ CheckAndFixConfigs()

void CheckAndFixConfigs ( int32  nnet_modulus)
inline

Definition at line 107 of file nnet-am-decodable-simple.h.

References NnetSimpleComputationOptions::frame_subsampling_factor, KALDI_ASSERT, KALDI_ERR, KALDI_LOG, kaldi::Lcm(), and rnnlm::n.

Referenced by DecodableNnetSimple::GetOutput(), and NnetBatchComputer::NnetBatchComputer().

107  {
108  static bool warned_frames_per_chunk = false;
110  KALDI_ERR << "--frame-subsampling-factor and "
111  << "--frames-per-chunk must be > 0";
112  }
113  KALDI_ASSERT(nnet_modulus > 0);
114  int32 n = Lcm(frame_subsampling_factor, nnet_modulus);
115 
116  if (frames_per_chunk % n != 0) {
117  // round up to the nearest multiple of n.
118  int32 new_frames_per_chunk = n * ((frames_per_chunk + n - 1) / n);
119  if (!warned_frames_per_chunk) {
120  warned_frames_per_chunk = true;
121  if (nnet_modulus == 1) {
122  // simpler error message.
123  KALDI_LOG << "Increasing --frames-per-chunk from " << frames_per_chunk
124  << " to " << new_frames_per_chunk
125  << " to make it a multiple of "
126  << "--frame-subsampling-factor="
128  } else {
129  KALDI_LOG << "Increasing --frames-per-chunk from " << frames_per_chunk
130  << " to " << new_frames_per_chunk << " due to "
131  << "--frame-subsampling-factor=" << frame_subsampling_factor
132  << " and "
133  << "nnet shift-invariance modulus = " << nnet_modulus;
134  }
135  }
136  frames_per_chunk = new_frames_per_chunk;
137  }
138  }
kaldi::int32 int32
I Lcm(I m, I n)
Returns the least common multiple of two integers.
Definition: kaldi-math.h:318
struct rnnlm::@11::@12 n
#define KALDI_ERR
Definition: kaldi-error.h:147
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185
#define KALDI_LOG
Definition: kaldi-error.h:153

◆ Register()

void Register ( OptionsItf opts)
inline

Definition at line 68 of file nnet-am-decodable-simple.h.

References OptionsItf::Register(), NnetComputeOptions::Register(), and NnetOptimizeOptions::Register().

Referenced by main(), and NnetBatchComputerOptions::Register().

68  {
69  opts->Register("extra-left-context", &extra_left_context,
70  "Number of frames of additional left-context to add on top "
71  "of the neural net's inherent left context (may be useful in "
72  "recurrent setups");
73  opts->Register("extra-right-context", &extra_right_context,
74  "Number of frames of additional right-context to add on top "
75  "of the neural net's inherent right context (may be useful in "
76  "recurrent setups");
77  opts->Register("extra-left-context-initial", &extra_left_context_initial,
78  "If >= 0, overrides the --extra-left-context value at the "
79  "start of an utterance.");
80  opts->Register("extra-right-context-final", &extra_right_context_final,
81  "If >= 0, overrides the --extra-right-context value at the "
82  "end of an utterance.");
83  opts->Register("frame-subsampling-factor", &frame_subsampling_factor,
84  "Required if the frame-rate of the output (e.g. in 'chain' "
85  "models) is less than the frame-rate of the original "
86  "alignment.");
87  opts->Register("acoustic-scale", &acoustic_scale,
88  "Scaling factor for acoustic log-likelihoods (caution: is a no-op "
89  "if set in the program nnet3-compute");
90  opts->Register("frames-per-chunk", &frames_per_chunk,
91  "Number of frames in each chunk that is separately evaluated "
92  "by the neural net. Measured before any subsampling, if the "
93  "--frame-subsampling-factor options is used (i.e. counts "
94  "input frames");
95  opts->Register("debug-computation", &debug_computation, "If true, turn on "
96  "debug for the actual computation (very verbose!)");
97 
98  // register the optimization options with the prefix "optimization".
99  ParseOptions optimization_opts("optimization", opts);
100  optimize_config.Register(&optimization_opts);
101 
102  // register the compute options with the prefix "computation".
103  ParseOptions compute_opts("computation", opts);
104  compute_config.Register(&compute_opts);
105  }
void Register(OptionsItf *opts)
Definition: nnet-optimize.h:84
void Register(OptionsItf *opts)
Definition: nnet-compute.h:42

Member Data Documentation

◆ acoustic_scale

◆ compiler_config

Definition at line 54 of file nnet-am-decodable-simple.h.

◆ compute_config

NnetComputeOptions compute_config

Definition at line 53 of file nnet-am-decodable-simple.h.

Referenced by NnetBatchComputer::Compute().

◆ debug_computation

bool debug_computation

Definition at line 51 of file nnet-am-decodable-simple.h.

◆ extra_left_context

int32 extra_left_context

◆ extra_left_context_initial

int32 extra_left_context_initial

◆ extra_right_context

int32 extra_right_context

◆ extra_right_context_final

int32 extra_right_context_final

◆ frame_subsampling_factor

◆ frames_per_chunk

◆ optimize_config

NnetOptimizeOptions optimize_config

Definition at line 52 of file nnet-am-decodable-simple.h.

Referenced by main().


The documentation for this struct was generated from the following file: