DecodableNnetSimpleLoopedInfo Class Reference

When you instantiate class DecodableNnetSimpleLooped, you should give it a const reference to this class, that has been previously initialized. More...

#include <decodable-simple-looped.h>

Collaboration diagram for DecodableNnetSimpleLoopedInfo:

Public Member Functions

 DecodableNnetSimpleLoopedInfo (const NnetSimpleLoopedComputationOptions &opts, Nnet *nnet)
 
 DecodableNnetSimpleLoopedInfo (const NnetSimpleLoopedComputationOptions &opts, AmNnetSimple *nnet)
 
 DecodableNnetSimpleLoopedInfo (const NnetSimpleLoopedComputationOptions &opts, const Vector< BaseFloat > &priors, Nnet *nnet)
 
void Init (const NnetSimpleLoopedComputationOptions &opts, Nnet *nnet)
 

Public Attributes

const NnetSimpleLoopedComputationOptionsopts
 
const Nnetnnet
 
CuVector< BaseFloatlog_priors
 
int32 frames_left_context
 
int32 frames_right_context
 
int32 frames_per_chunk
 
int32 output_dim
 
bool has_ivectors
 
ComputationRequest request1
 
ComputationRequest request2
 
ComputationRequest request3
 
NnetComputation computation
 

Detailed Description

When you instantiate class DecodableNnetSimpleLooped, you should give it a const reference to this class, that has been previously initialized.

Definition at line 102 of file decodable-simple-looped.h.

Constructor & Destructor Documentation

◆ DecodableNnetSimpleLoopedInfo() [1/3]

Definition at line 28 of file decodable-simple-looped.cc.

References DecodableNnetSimpleLoopedInfo::Init().

30  :
31  opts(opts), nnet(*nnet) {
32  Init(opts, nnet);
33 }
const NnetSimpleLoopedComputationOptions & opts
void Init(const NnetSimpleLoopedComputationOptions &opts, Nnet *nnet)

◆ DecodableNnetSimpleLoopedInfo() [2/3]

Definition at line 46 of file decodable-simple-looped.cc.

References AmNnetSimple::GetNnet(), DecodableNnetSimpleLoopedInfo::Init(), and DecodableNnetSimpleLoopedInfo::log_priors.

48  :
49  opts(opts), nnet(am_nnet->GetNnet()), log_priors(am_nnet->Priors()) {
50  if (log_priors.Dim() != 0)
51  log_priors.ApplyLog();
52  Init(opts, &(am_nnet->GetNnet()));
53 }
const NnetSimpleLoopedComputationOptions & opts
void Init(const NnetSimpleLoopedComputationOptions &opts, Nnet *nnet)

◆ DecodableNnetSimpleLoopedInfo() [3/3]

DecodableNnetSimpleLoopedInfo ( const NnetSimpleLoopedComputationOptions opts,
const Vector< BaseFloat > &  priors,
Nnet nnet 
)

Definition at line 35 of file decodable-simple-looped.cc.

References DecodableNnetSimpleLoopedInfo::Init(), and DecodableNnetSimpleLoopedInfo::log_priors.

38  :
39  opts(opts), nnet(*nnet), log_priors(priors) {
40  if (log_priors.Dim() != 0)
41  log_priors.ApplyLog();
42  Init(opts, nnet);
43 }
const NnetSimpleLoopedComputationOptions & opts
void Init(const NnetSimpleLoopedComputationOptions &opts, Nnet *nnet)

Member Function Documentation

◆ Init()

void Init ( const NnetSimpleLoopedComputationOptions opts,
Nnet nnet 
)

Definition at line 55 of file decodable-simple-looped.cc.

References NnetSimpleLoopedComputationOptions::Check(), kaldi::nnet3::CompileLooped(), DecodableNnetSimpleLoopedInfo::computation, NnetComputation::ComputeCudaIndexes(), kaldi::nnet3::ComputeSimpleNnetContext(), kaldi::nnet3::CreateLoopedComputationRequest(), NnetSimpleLoopedComputationOptions::extra_left_context_initial, NnetSimpleLoopedComputationOptions::frame_subsampling_factor, DecodableNnetSimpleLoopedInfo::frames_left_context, NnetSimpleLoopedComputationOptions::frames_per_chunk, DecodableNnetSimpleLoopedInfo::frames_per_chunk, DecodableNnetSimpleLoopedInfo::frames_right_context, kaldi::nnet3::GetChunkSize(), DecodableNnetSimpleLoopedInfo::has_ivectors, Nnet::InputDim(), kaldi::nnet3::IsSimpleNnet(), KALDI_ASSERT, KALDI_VLOG, kaldi::nnet3::ModifyNnetIvectorPeriod(), NnetSimpleLoopedComputationOptions::optimize_config, DecodableNnetSimpleLoopedInfo::output_dim, Nnet::OutputDim(), DecodableNnetSimpleLoopedInfo::request1, DecodableNnetSimpleLoopedInfo::request2, and DecodableNnetSimpleLoopedInfo::request3.

Referenced by DecodableNnetSimpleLoopedInfo::DecodableNnetSimpleLoopedInfo().

57  {
58  opts.Check();
60  has_ivectors = (nnet->InputDim("ivector") > 0);
61  int32 left_context, right_context;
62  int32 extra_right_context = 0;
63  ComputeSimpleNnetContext(*nnet, &left_context, &right_context);
65  frames_right_context = right_context + extra_right_context;
68  output_dim = nnet->OutputDim("output");
70  // note, ivector_period is hardcoded to the same as frames_per_chunk_.
71  int32 ivector_period = frames_per_chunk;
72  if (has_ivectors)
73  ModifyNnetIvectorPeriod(ivector_period, nnet);
74 
75  int32 num_sequences = 1; // we're processing one utterance at a time.
76 
79  ivector_period,
82  num_sequences,
84 
86  &computation);
88  KALDI_VLOG(3) << "Computation is:\n"
89  << NnetComputationPrintInserter{computation, *nnet};
90 }
void ModifyNnetIvectorPeriod(int32 ivector_period, Nnet *nnet)
This function modifies the descriptors in the neural network to change the periodicity with which it ...
int32 InputDim(const std::string &input_name) const
Definition: nnet-nnet.cc:669
int32 GetChunkSize(const Nnet &nnet, int32 frame_subsampling_factor, int32 advised_chunk_size)
void CreateLoopedComputationRequest(const Nnet &nnet, int32 chunk_size, int32 frame_subsampling_factor, int32 ivector_period, int32 left_context_begin, int32 right_context, int32 num_sequences, ComputationRequest *request1, ComputationRequest *request2, ComputationRequest *request3)
This function creates computation request suitable for giving to ComputeLooped(). ...
kaldi::int32 int32
int32 OutputDim(const std::string &output_name) const
Definition: nnet-nnet.cc:677
const NnetSimpleLoopedComputationOptions & opts
void CompileLooped(const Nnet &nnet, const NnetOptimizeOptions &optimize_opts, const ComputationRequest &request1, const ComputationRequest &request2, const ComputationRequest &request3, NnetComputation *computation)
CompileLooped() provides an internal interface for &#39;looped&#39; computation.
void ComputeSimpleNnetContext(const Nnet &nnet, int32 *left_context, int32 *right_context)
ComputeSimpleNnetContext computes the left-context and right-context of a nnet.
Definition: nnet-utils.cc:146
bool IsSimpleNnet(const Nnet &nnet)
This function returns true if the nnet has the following properties: It has an output called "output"...
Definition: nnet-utils.cc:52
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185
#define KALDI_VLOG(v)
Definition: kaldi-error.h:156

Member Data Documentation

◆ computation

NnetComputation computation

Definition at line 153 of file decodable-simple-looped.h.

Referenced by DecodableNnetSimpleLoopedInfo::Init().

◆ frames_left_context

◆ frames_per_chunk

◆ frames_right_context

◆ has_ivectors

◆ log_priors

◆ nnet

◆ opts

◆ output_dim

◆ request1

◆ request2

◆ request3

Definition at line 150 of file decodable-simple-looped.h.

Referenced by DecodableNnetSimpleLoopedInfo::Init().


The documentation for this class was generated from the following files: