nnet-compile-utils.h
Go to the documentation of this file.
1 // nnet3/nnet-compile-utils.h
2 
3 // Copyright 2015 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_UTILS_H_
21 #define KALDI_NNET3_NNET_COMPILE_UTILS_H_
22 
24 #include "nnet3/nnet-nnet.h"
25 #include "nnet3/nnet-computation.h"
27 #include <iostream>
28 
29 namespace kaldi {
30 namespace nnet3 {
31 // this file contains some utility functions used in nnet-compile.h
32 
33 
81 void SplitLocations(
82  const std::vector<std::vector<std::pair<int32, int32> > > &submat_lists,
83  std::vector<std::vector<std::pair<int32, int32> > > *split_lists);
84 
85 
112  const std::vector<std::vector<std::pair<int32, int32> > > &submat_lists,
113  std::vector<std::vector<std::pair<int32, int32> > > *split_lists);
114 
115 
120 bool ConvertToIndexes(
121  const std::vector<std::pair<int32, int32> > &location_vector,
122  int32 *first_value,
123  std::vector<int32> *second_values);
124 
134 bool HasContiguousProperty(const std::vector<int32> &indexes,
135  std::vector<std::pair<int32, int32> > *reverse_indexes);
136 
137 
150  const std::vector<int32> &indexes,
151  std::vector<std::vector<int32> > *indexes_out);
152 
159 void GetTList(const std::vector<Index> &indexes,
160  std::vector<int32> *t_values);
161 
162 
169 void GetTList(const std::vector<Index> &indexes,
170  std::vector<int32> *t_values);
171 
176 void GetNxList(const std::vector<Index> &indexes,
177  std::vector<std::pair<int32, int32> > *pairs);
178 
179 
180 } // namespace nnet3
181 } // namespace kaldi
182 
183 
184 #endif
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
void GetTList(const std::vector< Index > &indexes, std::vector< int32 > *t_values)
This function outputs a sorted, unique list of the &#39;t&#39; values that are encountered in the provided li...
bool HasContiguousProperty(const std::vector< int32 > &indexes, std::vector< std::pair< int32, int32 > > *reverse_indexes)
This function returns true if for each integer i != -1, all the indexes j at which indexes[j] == i ar...
bool ConvertToIndexes(const std::vector< std::pair< int32, int32 > > &location_vector, int32 *first_value, std::vector< int32 > *second_values)
If it is the case for some i >= 0 that all the .first elements of "location_vector" are either i or -...
kaldi::int32 int32
The two main classes defined in this header are struct ComputationRequest, which basically defines a ...
void SplitLocations(const std::vector< std::vector< std::pair< int32, int32 > > > &submat_lists, std::vector< std::vector< std::pair< int32, int32 > > > *split_lists)
The input to this function is a vector (indexed by matrix-row-index) of lists of pairs (submat_index...
void EnsureContiguousProperty(const std::vector< int32 > &indexes, std::vector< std::vector< int32 > > *indexes_out)
This function takes a vector of indexes and splits it up into as separate vectors of the same size...
void SplitLocationsBackward(const std::vector< std::vector< std::pair< int32, int32 > > > &submat_lists, std::vector< std::vector< std::pair< int32, int32 > > > *split_lists)
This function has the same interface as SplitLocations(); however, it ensures certain additional prop...
void GetNxList(const std::vector< Index > &indexes, std::vector< std::pair< int32, int32 > > *pairs)
This function outputs a unique, lexicographically sorted list of the pairs of (n, x) values that are ...