nnet-compile-looped.h
Go to the documentation of this file.
1 // nnet3/nnet-compile-looped.h
2 
3 // Copyright 2016 Johns Hopkins University (author: Daniel Povey)
4 
5 // See ../../COPYING for clarification regarding multiple authors
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16 // MERCHANTABLITY OR NON-INFRINGEMENT.
17 // See the Apache 2 License for the specific language governing permissions and
18 // limitations under the License.
19 
20 #ifndef KALDI_NNET3_NNET_COMPILE_LOOPED_H_
21 #define KALDI_NNET3_NNET_COMPILE_LOOPED_H_
22 
23 #include "nnet3/nnet-optimize.h"
24 #include "nnet3/nnet-utils.h"
25 
26 #include <list>
27 
28 namespace kaldi {
29 namespace nnet3 {
30 
31 
61 void CompileLooped(const Nnet &nnet,
62  const NnetOptimizeOptions &optimize_opts,
63  const ComputationRequest &request1,
64  const ComputationRequest &request2,
65  const ComputationRequest &request3,
66  NnetComputation *computation);
67 
68 /*
69  This function gives you a suitable chunk size, which is the smallest number >=
70  'advised_chunk_size' that is an exact multiple of nnet.Modulus() and
71  frame_subsampling_factor. This will ensure that all the chunks have the same
72  structure, which makes compiling the looped computation a little more
73  straightforward.
74  */
75 int32 GetChunkSize(const Nnet &nnet,
76  int32 frame_subsampling_factor,
77  int32 advised_chunk_size);
78 
98 void ModifyNnetIvectorPeriod(int32 ivector_period,
99  Nnet *nnet);
100 
162 void CreateLoopedComputationRequest(const Nnet &nnet,
163  int32 chunk_size,
164  int32 frame_subsampling_factor,
165  int32 ivector_period,
166  int32 left_context_begin,
167  int32 right_context,
168  int32 num_sequences,
169  ComputationRequest *request1,
170  ComputationRequest *request2,
171  ComputationRequest *request3);
172 
173 
181 void CreateLoopedComputationRequestSimple(const Nnet &nnet,
182  int32 chunk_size,
183  int32 frame_subsampling_factor,
184  int32 ivector_period,
185  int32 extra_left_context_begin,
186  int32 extra_right_context,
187  int32 num_sequences,
188  ComputationRequest *request1,
189  ComputationRequest *request2,
190  ComputationRequest *request3);
191 
192 
193 
194 
195 
196 } // namespace nnet3
197 } // namespace kaldi
198 
199 
200 #endif
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
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)
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
void NnetComputation(const Nnet &nnet, const CuMatrixBase< BaseFloat > &input, bool pad_input, CuMatrixBase< BaseFloat > *output)
Does the basic neural net computation, on a sequence of data (e.g.
This file contains some miscellaneous functions dealing with class Nnet.
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 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 is deprecated.