36 template<
typename Real>
38 std::istringstream is(s +
"\n");
43 std::istringstream is(s +
"\n");
73 "<SimpleSentenceAveragingComponent> 2 2 <GradientBoost> 10.0" 95 for (
int32 i = 0;
i < diff_in.NumRows();
i++) {
103 <PatchDim> 1 <PatchStep> 1 <PatchStride> 5 \ 104 <LearnRateCoef> 1.0 <BiasLearnRateCoef> 1.0 \ 117 KALDI_LOG <<
"mat_in" << mat_in <<
"mat_out" << mat_out;
122 c->
Backpropagate(mat_in, mat_out, mat_out_diff, &mat_in_diff);
123 KALDI_LOG <<
"mat_out_diff " << mat_out_diff
124 <<
" mat_in_diff " << mat_in_diff;
135 <PatchDim> 3 <PatchStep> 1 <PatchStride> 5 \ 136 <LearnRateCoef> 1.0 <BiasLearnRateCoef> 1.0 \ 138 <Filters> [ -1 -2 -7 0 0 0 1 2 7 ; \ 139 -1 0 1 -3 0 3 -2 2 0 ; \ 140 -4 0 0 -3 0 3 4 0 0 ] \ 141 <Bias> [ -20 -20 -20 ]" 153 KALDI_LOG <<
"mat_in" << mat_in <<
"mat_out" << mat_out;
166 c->
Backpropagate(mat_in, mat_out, mat_out_diff, &mat_in_diff);
167 KALDI_LOG <<
"mat_in_diff " << mat_in_diff
168 <<
" mat_in_diff_ref " << mat_in_diff_ref;
180 "<MaxPoolingComponent> <InputDim> 24 <OutputDim> 8 \ 181 <PoolSize> 3 <PoolStep> 3 <PoolStride> 4" 200 8 2 1 7 ]", &mat_in);
207 8 4 5 7 ]", &mat_out_ref);
212 KALDI_LOG <<
"mat_out" << mat_out <<
"mat_out_ref" << mat_out_ref;
234 1 0 0 1 ]", &mat_in_diff_ref);
237 c->
Backpropagate(mat_in, mat_out, mat_out_diff, &mat_in_diff);
238 KALDI_LOG <<
"mat_in_diff " << mat_in_diff
239 <<
" mat_in_diff_ref " << mat_in_diff_ref;
271 using namespace kaldi;
278 CuDevice::Instantiate().SelectGpuId(
"no");
281 CuDevice::Instantiate().SelectGpuId(
"optional");
292 KALDI_LOG <<
"Tests without GPU use succeeded.";
294 KALDI_LOG <<
"Tests with GPU use (if available) succeeded.";
297 CuDevice::Instantiate().PrintProfile();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
const CuSubVector< Real > Row(MatrixIndexT i) const
void Backpropagate(const CuMatrixBase< BaseFloat > &in, const CuMatrixBase< BaseFloat > &out, const CuMatrixBase< BaseFloat > &out_diff, CuMatrix< BaseFloat > *in_diff)
Perform backward-pass propagation 'out_diff' -> 'in_diff'.
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
static Component * Init(const std::string &conf_line)
Initialize component from a line in config file,.
void UnitTestSimpleSentenceAveragingComponent()
static Component * Read(std::istream &is, bool binary)
Read the component from a stream (static method),.
Component * ReadComponentFromString(const std::string &s)
void AddColSumMat(Real alpha, const CuMatrixBase< Real > &mat, Real beta=1.0)
Sum the columns of the matrix, add to vector.
void MulElements(const CuMatrixBase< Real > &A)
Multiply two matrices elementwise: C = C .* A.
void UnitTestLengthNorm()
void Propagate(const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *out)
Perform forward-pass propagation 'in' -> 'out',.
void ApplyPow(Real power)
void UnitTestConvolutionalComponentUnity()
void Read(std::istream &is, bool binary)
I/O functions.
void UnitTestDropoutComponent()
static void AssertEqual(float a, float b, float relative_tolerance=0.001)
assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b))
Abstract class, building block of the network.
void UnitTestConvolutionalComponent3x3()
void UnitTestMaxPoolingComponent()
MatrixIndexT NumRows() const
Dimensions.
void ReadCuMatrixFromString(const std::string &s, CuMatrix< Real > *m)