kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
test-golden.h File Reference

kaldi-native-fbank/kaldi-native-fbank/csrc/test-golden.h More...

#include <stdint.h>
#include <cmath>
#include <fstream>
#include <string>
#include <vector>
#include "kaldi-native-fbank/csrc/feature-matrix.h"
Include dependency graph for test-golden.h:

Go to the source code of this file.

Namespaces

namespace  knf
 This file is part of kaldi-native-fbank.

Functions

bool knf::LoadNpy (const std::string &path, MatrixD *out)
 Minimal .npy (v1/v2, C-order, float32/float64) reader for golden files.
std::string knf::GoldenDir ()
 Locate tests/data/feat_golden relative to this header.
double knf::MaxAbsDiff (const MatrixF &a, const MatrixD &b)
 Return the maximum absolute difference between a float matrix and a double matrix of the same shape (for golden comparisons).

Variables

constexpr double knf::kGoldenDotProductTol = 1e-4
 Comparison tolerance for golden matrices whose kaldi reference was produced by matrix multiplications or long dot products (the LDA transform-feats outputs and the pitch NCCF): kaldi's BLAS and Eigen accumulate the sums in different orders, which gives per-platform float noise of up to a few 1e-5.

Detailed Description

kaldi-native-fbank/kaldi-native-fbank/csrc/test-golden.h

Shared helpers for golden-file unit tests.

The golden test data (kaldi-generated .npy matrices) lives in tests/data/feat_golden; see the README there for how it was generated. These helpers read that data and locate it from the source tree; they are shared by the test-*.cc gtests.