All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
NnetSimpleLoopedComputationOptions
opts
 
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

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)

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

References CuVectorBase< Real >::ApplyLog(), CuVectorBase< Real >::Dim(), 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)
52  Init(opts, &(am_nnet->GetNnet()));
53 }
const NnetSimpleLoopedComputationOptions & opts
MatrixIndexT Dim() const
Dimensions.
Definition: cu-vector.h:67
void Init(const NnetSimpleLoopedComputationOptions &opts, Nnet *nnet)
DecodableNnetSimpleLoopedInfo ( const NnetSimpleLoopedComputationOptions opts,
const Vector< BaseFloat > &  priors,
Nnet nnet 
)

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

References CuVectorBase< Real >::ApplyLog(), CuVectorBase< Real >::Dim(), DecodableNnetSimpleLoopedInfo::Init(), and DecodableNnetSimpleLoopedInfo::log_priors.

38  :
39  opts(opts), nnet(*nnet), log_priors(priors) {
40  if (log_priors.Dim() != 0)
42  Init(opts, nnet);
43 }
const NnetSimpleLoopedComputationOptions & opts
MatrixIndexT Dim() const
Dimensions.
Definition: cu-vector.h:67
void Init(const NnetSimpleLoopedComputationOptions &opts, Nnet *nnet)

Member Function Documentation

void Init ( const NnetSimpleLoopedComputationOptions opts,
Nnet nnet 
)

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

References NnetSimpleLoopedComputationOptions::Check(), kaldi::nnet3::CompileLooped(), DecodableNnetSimpleLoopedInfo::computation, NnetComputation::ComputeCudaIndexes(), kaldi::nnet3::ComputeSimpleNnetContext(), kaldi::nnet3::CreateLoopedComputationRequestSimple(), 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(), kaldi::GetVerboseLevel(), DecodableNnetSimpleLoopedInfo::has_ivectors, Nnet::InputDim(), kaldi::nnet3::IsSimpleNnet(), KALDI_ASSERT, KALDI_VLOG, kaldi::nnet3::ModifyNnetIvectorPeriod(), NnetSimpleLoopedComputationOptions::optimize_config, DecodableNnetSimpleLoopedInfo::output_dim, Nnet::OutputDim(), NnetComputation::Print(), DecodableNnetSimpleLoopedInfo::request1, DecodableNnetSimpleLoopedInfo::request2, and DecodableNnetSimpleLoopedInfo::request3.

Referenced by DecodableNnetSimpleLoopedInfo::DecodableNnetSimpleLoopedInfo().

58  {
59  opts.Check();
61  has_ivectors = (nnet->InputDim("ivector") > 0);
62  int32 left_context, right_context;
63  ComputeSimpleNnetContext(*nnet, &left_context, &right_context);
65  frames_right_context = 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  int32 extra_right_context = 0;
79  ivector_period,
81  extra_right_context,
82  num_sequences,
84 
86  &computation);
88  if (GetVerboseLevel() >= 3) {
89  KALDI_VLOG(3) << "Computation is:";
90  computation.Print(std::cerr, *nnet);
91  }
92 }
void ModifyNnetIvectorPeriod(int32 ivector_period, Nnet *nnet)
This function modifies the descriptors in the neural network to change the periodicity with which it ...
int32 GetChunkSize(const Nnet &nnet, int32 frame_subsampling_factor, int32 advised_chunk_size)
int32 InputDim(const std::string &input_name) const
Definition: nnet-nnet.cc:669
int32 GetVerboseLevel()
Definition: kaldi-error.h:69
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 'looped' 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:142
void CreateLoopedComputationRequestSimple(const Nnet &nnet, int32 chunk_size, int32 frame_subsampling_factor, int32 ivector_period, int32 extra_left_context_begin, int32 extra_right_context, int32 num_sequences, ComputationRequest *request1, ComputationRequest *request2, ComputationRequest *request3)
This function creates computation request suitable for giving to ComputeLooped(). ...
int32 OutputDim(const std::string &output_name) const
Definition: nnet-nnet.cc:677
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:51
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:169
void Print(std::ostream &os, const Nnet &nnet) const
#define KALDI_VLOG(v)
Definition: kaldi-error.h:136

Member Data Documentation

NnetComputation computation

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

Referenced by DecodableNnetSimpleLoopedInfo::Init().

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: