29 using namespace kaldi;
    37                  const std::vector<T> &vec2) {
    42   if (vec1.size() > 0) {
    43     const char *p1 = 
reinterpret_cast<const char*
>(&(vec1[0]));
    44     const char *p2 = 
reinterpret_cast<const char*
>(&(vec2[0]));
    45     size_t size = 
sizeof(T) * vec1.size();
    46     for (
size_t i = 0; 
i < size; 
i++)
    56     size = size * size * size; 
    58     std::vector<T> vec(size);
    59     std::vector<T> garbage_vec(size2); 
    63     int32 byte_size = size * 
sizeof(T);
    64     std::vector<char> rand_c(byte_size);
    65     for (
size_t i = 0; 
i < byte_size; 
i++)
    66       rand_c[
i] = 
Rand() % 256;
    68       std::memcpy((
void*)&(vec[0]), (
void*)&(rand_c[0]),
    76       T *vec22 = 
new T[vec.size()];
    94       std::vector<T> vec2(vec);
    97         std::memset(&(vec2[0]), 0, vec2.size() * 
sizeof(T));
   103     if (
sizeof(T) == 
sizeof(
int32) && size > 0) { 
   106       for (
size_t i = 1; 
i < vec.size(); 
i++) vec[
i] = vec[0];
   122   for (; loop < 2; loop++) {
   123     CuDevice::Instantiate().SetDebugStrideMode(
true);
   125       CuDevice::Instantiate().SelectGpuId(
"no");
   127       CuDevice::Instantiate().SelectGpuId(
"yes");
   131     kaldi::UnitTestCuArray<double>();
   132     kaldi::UnitTestCuArray<int32>();
   133     kaldi::UnitTestCuArray<std::pair<int32, int32> >();
   136       KALDI_LOG << 
"Tests without GPU use succeeded.";
   138       KALDI_LOG << 
"Tests with GPU use (if available) succeeded.";
   141   CuDevice::Instantiate().PrintProfile();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void CopyToVec(std::vector< T > *dst) const
This function resizes *dst if needed. 
 
void SetVerboseLevel(int32 i)
This should be rarely used, except by programs using Kaldi as library; command-line programs set the ...
 
static void UnitTestCuArray()
 
void Set(const T &value)
Set to a constant value. 
 
void CopyToHost(T *dst) const
Version of the above function that copies contents to a host array (i.e. 
 
int Rand(struct RandomState *state)
 
Class CuArray represents a vector of an integer or struct of type T. 
 
#define KALDI_ASSERT(cond)
 
void Resize(MatrixIndexT dim, MatrixResizeType resize_type=kSetZero)
Allocate the memory. 
 
static void AssertEqual(float a, float b, float relative_tolerance=0.001)
assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b)) 
 
MatrixIndexT Dim() const
Return the vector dimension.