kaldi.cudamatrix

Functions

approx_equal_cu_double_matrix Calls C++ function
approx_equal_cu_double_vector Calls C++ function
approx_equal_cu_matrix Calls C++ function
approx_equal_cu_vector Calls C++ function
assert_equal_cu_double_matrix Calls C++ function
assert_equal_cu_double_vector Calls C++ function
assert_equal_cu_matrix Calls C++ function
assert_equal_cu_vector Calls C++ function
cuda_available Check if cuda is available.
same_dim_and_stride_cu_double_matrix Calls C++ function
same_dim_and_stride_cu_matrix Calls C++ function
same_dim_cu_double_matrix Calls C++ function
same_dim_cu_matrix Calls C++ function
synchronize_gpu Synchronizes threads.
trace_mat_smat If trans==kNoTrans compute Trace(A*B).

Classes

CuArray CLIF wrapper for ::kaldi::CuArray<int>
CuBlockMatrixData CLIF wrapper for ::CuBlockMatrixData_
CuDevice CUDA Device.
CuDoubleMatrix CLIF wrapper for ::kaldi::CuMatrix<double>
CuDoubleMatrixBase CLIF wrapper for ::kaldi::CuMatrixBase<double>
CuDoublePtrArray CLIF wrapper for ::kaldi::CuArray<double *>
CuDoubleSubMatrix CLIF wrapper for ::kaldi::CuSubMatrix<double>
CuDoubleSubVector CLIF wrapper for ::kaldi::CuSubVector<double>
CuDoubleVector CLIF wrapper for ::kaldi::CuVector<double>
CuDoubleVectorBase CLIF wrapper for ::kaldi::CuVectorBase<double>
CuFloatPtrArray CLIF wrapper for ::kaldi::CuArray<float *>
CuIntPairArray CLIF wrapper for ::kaldi::CuArray< ::Int32Pair>
CuMatrix CLIF wrapper for ::kaldi::CuMatrix<float>
CuMatrixBase CLIF wrapper for ::kaldi::CuMatrixBase<float>
CuSparseMatrix This class defines a Sparse CUDA Matrix.
CuSubMatrix CLIF wrapper for ::kaldi::CuSubMatrix<float>
CuSubVector CLIF wrapper for ::kaldi::CuSubVector<float>
CuTimer Convenience wrapper for Timer.
CuVector CLIF wrapper for ::kaldi::CuVector<float>
CuVectorBase CLIF wrapper for ::kaldi::CuVectorBase<float>
DoubleMatrixElement CLIF wrapper for ::MatrixElement<double>
IntPair CLIF wrapper for ::Int32Pair
MatrixDim CLIF wrapper for ::MatrixDim_
MatrixElement CLIF wrapper for ::MatrixElement<float>
class kaldi.cudamatrix.CuArray

CLIF wrapper for ::kaldi::CuArray<int>

add(value:int)

Add a constant value

copy_from_array(src:CuArray)

This function resizes if needed.

copy_from_vec(src:list<int>)

This function resizes if needed.

copy_to_vec() → list<int>

This function resizes dst if needed.

destroy()

Deallocate the memory and set dim_ and data_ to zero.

dim() → int
Returns:This vector dimension
from_other(src:CuArray) → CuArray

Calls C++ function std::unique_ptr<::kaldi::CuArray<int>> ::kaldi::CuArray<int>::CuArray(::kaldi::CuArray<int>)

from_size(dim:int, resize_type:MatrixResizeType=default) → CuArray

Calls C++ function std::unique_ptr<::kaldi::CuArray<int>> ::kaldi::CuArray<int>::CuArray(int, ::kaldi::MatrixResizeType)

from_vector(src:list<int>) → CuArray

Calls C++ function std::unique_ptr<::kaldi::CuArray<int>> ::kaldi::CuArray<int>::CuArray(::std::vector<int>)

max() → int
Returns:Maximum value
min() → int
Returns:Minimum value
read(is:istream, binary:bool)

I/O

resize(dim:int, resize_type:MatrixResizeType=default)

Allocate the memory.

set(value:int)

Set to a constant value.

set_zero()

Sets the memory for the object to zero.

write(os:ostream, binary:bool)

I/O

class kaldi.cudamatrix.CuBlockMatrixData

CLIF wrapper for ::CuBlockMatrixData_

col_offset

C++ ::int32_cuda CuBlockMatrixData_.col_offset

matrix_dim

C++ ::MatrixDim CuBlockMatrixData_.matrix_dim

row_offset

C++ ::int32_cuda CuBlockMatrixData_.row_offset

class kaldi.cudamatrix.CuDevice

CUDA Device.

This class is for initializing, selecting and querying a CUDA device.

There is a separate instance of the CuDevice object for each thread of the program, but many of its variables are static (hence, shared between all instances).

allow_multithreading()

Enables multi-threaded access to GPU.

The user should call this if the program plans to access the GPU (e.g. via using class CuMatrix) from more than one thread. If you fail to call this for a multi-threaded program, it may occasionally segfault (and also the code will detect that you failed to call it, and will print a warning).

check_gpu_health()

Check if GPU is in good condition.

This is done by multiplying small matrices on GPU+CPU. Overheated GPUs may give inaccurate results, which we want to detect.

double_precision_supported() → bool

Checks if double precision is supported.

Returns true if either we have no GPU, or we have a GPU and it supports double precision.

enabled() → bool

Checks if the CUDA GPU is selected for use.

instantiate() → CuDevice

Instantiates a new CuDevice.

You obtain the CuDevice for the current thread by calling CuDevice.instantiate At the beginning of the program, if you want to use a GPU, you should call CuDevice.instantiate().select_gpu_id(..).

is_compute_exclusive() → bool

Checks if the GPU is set to compute exclusive mode.

You can set this mode, if you are root, by doing: nvidia-smi -c 3.

Returns True if we have a GPU and it is running in compute exclusive mode. Returns false otherwise. WILL CRASH if we are not using a GPU at all. If calling this as a user (i.e. from outside the class), call this only if enabled() returns True.

print_memory_usage()

Print some memory-usage information using KALDI_LOG.

select_gpu_id(use_gpu:str)

Selects a GPU for computation.

This function is supposed to be called just once, at the beginning of the program (from the main thread), or not at all.

Parameters:use_gpu (str) – GPU use mode. One of “yes”, “optional” or “no”. “yes” – Select GPU automatically and die if this fails. If you have set the GPUs to exclusive mode it will select one pseudo-randomly; otherwise it will choose whichever one has the most free memory (but we recommend to set GPUs to exclusive mode, or controlling which GPU to use by setting the variable CUDA_VISIBLE_DEVICES to the id of the GPU you want the program to use. “optional” – Do as above, but if it fails, back off to CPU. “no” – Run on CPU.
set_debug_stride_mode(mode:bool) → bool

Activates debug stride mode.

Activates a mode where calls to MallocPitch will purposely allocate arrays with different pitch (inconsistent between calls). This is only useful for testing code. This function returns the previous mode, where true means inconsistent pitch. Note that you cannot ever rely on the strides from MallocPitch() being consistent for the same request, but in practice they tend to be consistent unless you are close to running out of memory.

class kaldi.cudamatrix.CuDoubleMatrix

CLIF wrapper for ::kaldi::CuMatrix<double>

add(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Add(double)

add_cols(src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddCols(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

add_diag_vec_mat(alpha:float, v:CuDoubleVectorBase, M:CuDoubleMatrixBase, transM:MatrixTransposeType, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddDiagVecMat(double, ::kaldi::CuVectorBase<double>, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, double)

add_elements(alpha:float, input:list<DoubleMatrixElement>)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddElements(double, ::std::vector< ::MatrixElement<double> >)

add_mat(alpha:float, A:CuDoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMat(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType)

add_mat_blocks(alpha:float, A:CuDoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMatBlocks(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType)

add_mat_diag_vec(alpha:float, M:CuDoubleMatrixBase, transM:MatrixTransposeType, v:CuDoubleVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMatDiagVec(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, ::kaldi::CuVectorBase<double>, double)

add_mat_mat(alpha:float, A:CuDoubleMatrixBase, transA:MatrixTransposeType, B:CuDoubleMatrixBase, transB:MatrixTransposeType, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMatMat(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, double)

add_mat_mat_elements(alpha:float, A:CuDoubleMatrixBase, B:CuDoubleMatrixBase, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMatMatElements(double, ::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, double)

add_row_ranges(src:CuDoubleMatrixBase, indexes:CuIntPairArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddRowRanges(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray< ::Int32Pair>)

add_rows(alpha:float, src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddRows(double, ::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

add_to_diag(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddToDiag(double)

add_to_rows(alpha:float, dst:CuDoublePtrArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddToRows(double, ::kaldi::CuArray<double *>)

add_vec_to_cols(alpha:float, col:CuDoubleVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddVecToCols(double, ::kaldi::CuVectorBase<double>, double)

add_vec_to_rows(alpha:float, row:CuDoubleVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddVecToRows(double, ::kaldi::CuVectorBase<double>, double)

add_vec_vec(alpha:float, x:CuDoubleVectorBase, y:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddVecVec(double, ::kaldi::CuVectorBase<double>, ::kaldi::CuVectorBase<double>)

apply_ceiling(ceiling_val:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyCeiling(double)

apply_exp()

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyExp()

apply_floor(floor_val:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyFloor(double)

apply_heaviside()

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyHeaviside()

apply_log()

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyLog()

apply_log_soft_max_per_row(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyLogSoftMaxPerRow(::kaldi::CuMatrixBase<double>)

apply_pow(power:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyPow(double)

apply_pow_abs(power:float, include_sign:bool=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyPowAbs(double, bool)

apply_soft_max_per_row(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplySoftMaxPerRow(::kaldi::CuMatrixBase<double>)

approx_equal(other:CuDoubleMatrixBase, tol:float=default) → bool

Calls C++ function bool ::kaldi::CuMatrixBase<double>::ApproxEqual(::kaldi::CuMatrixBase<double>, float)

cholesky(inv_cholesky:CuDoubleMatrixBase=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Cholesky(::kaldi::CuMatrixBase<double> *)

comp_objf_and_deriv(elements:list<DoubleMatrixElement>, A:CuDoubleMatrix) -> (tot_objf:float, tot_weight:float)

Calls C++ function void ::kaldi::CuMatrix<double>::CompObjfAndDeriv(::std::vector< ::MatrixElement<double> >, ::kaldi::CuMatrix<double>, double*, double*)

copy_col_from_cu_vec(v:CuDoubleVectorBase, col:int)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyColFromVec(::kaldi::CuVectorBase<double>, int)

copy_cols(src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyCols(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

copy_cols_from_cu_vec(v:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyColsFromVec(::kaldi::CuVectorBase<double>)

copy_from_cu_mat(src:CuDoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyFromMat(::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType)

copy_from_mat(src:DoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyFromMat(::kaldi::MatrixBase<double>, ::kaldi::MatrixTransposeType)

copy_lower_to_upper()

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyLowerToUpper()

copy_rows(src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyRows(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

copy_rows_from_cu_vec(v:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyRowsFromVec(::kaldi::CuVectorBase<double>)

copy_rows_from_vec(v:DoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyRowsFromVec(::kaldi::VectorBase<double>)

copy_to_mat(dst:DoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyToMat(::kaldi::MatrixBase<double> *, ::kaldi::MatrixTransposeType)

copy_to_rows(dst:CuDoublePtrArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyToRows(::kaldi::CuArray<double *>)

copy_upper_to_lower()

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyUpperToLower()

diff_group_pnorm(in_value:CuDoubleMatrixBase, out_value:CuDoubleMatrixBase, out_deriv:CuDoubleMatrixBase, power:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffGroupPnorm(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, double)

diff_log_softmax_per_row(out_value:CuDoubleMatrixBase, out_deriv:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffLogSoftmaxPerRow(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

diff_parametric_relu(value:CuDoubleMatrixBase, diff:CuDoubleMatrixBase, alpha:CuDoubleVectorBase, beta:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffParametricRelu(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, ::kaldi::CuVectorBase<double>, ::kaldi::CuVectorBase<double>)

diff_sigmoid(value:CuDoubleMatrixBase, diff:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffSigmoid(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

diff_softmax_per_row(value:CuDoubleMatrixBase, diff:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffSoftmaxPerRow(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

diff_tanh(value:CuDoubleMatrixBase, diff:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffTanh(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

diff_xent(tgt:CuArray) → CuDoubleVector

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffXent(::kaldi::CuArray<int>, ::kaldi::CuVector<double>*)

dim() → MatrixDim

Calls C++ function ::MatrixDim_ ::kaldi::CuMatrixBase<double>::Dim()

div_elements(A:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DivElements(::kaldi::CuMatrixBase<double>)

div_rows_vec(div:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DivRowsVec(::kaldi::CuVectorBase<double>)

find_row_max_id() → CuArray

Calls C++ function void ::kaldi::CuMatrixBase<double>::FindRowMaxId(::kaldi::CuArray<int>*)

frobenius_norm() → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::FrobeniusNorm()

from_matrix(other:DoubleMatrixBase, trans:MatrixTransposeType=default) → CuDoubleMatrix

Calls C++ function std::unique_ptr<::kaldi::CuMatrix<double>> ::kaldi::CuMatrix<double>::CuMatrix(::kaldi::MatrixBase<double>, ::kaldi::MatrixTransposeType)

from_other(other:CuDoubleMatrixBase, trans:MatrixTransposeType=default) → CuDoubleMatrix

Calls C++ function std::unique_ptr<::kaldi::CuMatrix<double>> ::kaldi::CuMatrix<double>::CuMatrix(::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType)

from_size(rows:int, cols:int, resize_type:MatrixResizeType=default, stride_type:MatrixStrideType=default) → CuDoubleMatrix

Calls C++ function std::unique_ptr<::kaldi::CuMatrix<double>> ::kaldi::CuMatrix<double>::CuMatrix(int, int, ::kaldi::MatrixResizeType, ::kaldi::MatrixStrideType)

group_max(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::GroupMax(::kaldi::CuMatrixBase<double>)

group_max_deriv(input:CuDoubleMatrixBase, output:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::GroupMaxDeriv(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

group_pnorm(src:CuDoubleMatrixBase, pow:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::GroupPnorm(::kaldi::CuMatrixBase<double>, double)

heaviside(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Heaviside(::kaldi::CuMatrixBase<double>)

invert_elements()

Calls C++ function void ::kaldi::CuMatrixBase<double>::InvertElements()

is_unit(tol:float=default) → bool

Calls C++ function bool ::kaldi::CuMatrixBase<double>::IsUnit(double)

max() → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::Max()

max_elementwise(A:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Max(::kaldi::CuMatrixBase<double>)

min() → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::Min()

min_elementwise(A:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Min(::kaldi::CuMatrixBase<double>)

mul_cols_vec(scale:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulColsVec(::kaldi::CuVectorBase<double>)

mul_elements(A:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulElements(::kaldi::CuMatrixBase<double>)

mul_rows(src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulRows(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

mul_rows_group_mat(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulRowsGroupMat(::kaldi::CuMatrixBase<double>)

mul_rows_vec(scale:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulRowsVec(::kaldi::CuVectorBase<double>)

num_cols() → int

Calls C++ function int ::kaldi::CuMatrixBase<double>::NumCols()

num_rows() → int

Calls C++ function int ::kaldi::CuMatrixBase<double>::NumRows()

parametric_relu(src:CuDoubleMatrixBase, alpha:CuDoubleVectorBase, beta:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ParametricRelu(::kaldi::CuMatrixBase<double>, ::kaldi::CuVectorBase<double>, ::kaldi::CuVectorBase<double>)

read(is:istream, binary:bool)

Calls C++ function void ::kaldi::CuMatrix<double>::Read(::std::basic_istream<char, ::std::char_traits<char> >, bool)

resize(rows:int, cols:int, resize_type:MatrixResizeType=default, stride_type:MatrixStrideType=default)

Calls C++ function void ::kaldi::CuMatrix<double>::Resize(int, int, ::kaldi::MatrixResizeType, ::kaldi::MatrixStrideType)

scale(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Scale(double)

set(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Set(double)

set_mat_mat_div_mat(A:CuDoubleMatrixBase, B:CuDoubleMatrixBase, C:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetMatMatDivMat(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

set_rand_uniform()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetRandUniform()

set_randn()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetRandn()

set_zero()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetZero()

set_zero_above_diag()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetZeroAboveDiag()

sigmoid(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Sigmoid(::kaldi::CuMatrixBase<double>)

size_in_bytes() → int

Calls C++ function int ::kaldi::CuMatrixBase<double>::SizeInBytes()

soft_hinge(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::SoftHinge(::kaldi::CuMatrixBase<double>)

stride() → int

Calls C++ function int ::kaldi::CuMatrixBase<double>::Stride()

sum() → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::Sum()

sum_column_ranges(src:CuDoubleMatrixBase, indexes:CuIntPairArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::SumColumnRanges(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray< ::Int32Pair>)

swap(mat:CuDoubleMatrix)

Calls C++ function void ::kaldi::CuMatrix<double>::Swap(::kaldi::CuMatrix<double> *)

swap_with_matrix(mat:DoubleMatrix)

Calls C++ function void ::kaldi::CuMatrix<double>::Swap(::kaldi::Matrix<double> *)

sym_add_mat2(alpha:float, M:CuDoubleMatrixBase, transA:MatrixTransposeType, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::SymAddMat2(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, double)

sym_invert_pos_def()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SymInvertPosDef()

tanh(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Tanh(::kaldi::CuMatrixBase<double>)

trace(check_square:bool=default) → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::Trace(bool)

transpose()

Calls C++ function void ::kaldi::CuMatrix<double>::Transpose()

write(os:ostream, binary:bool)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Write(::std::basic_ostream<char, ::std::char_traits<char> >, bool)

class kaldi.cudamatrix.CuDoublePtrArray

CLIF wrapper for ::kaldi::CuArray<double *>

copy_from_array(src:CuDoublePtrArray)

This function resizes if needed.

destroy()

Deallocate the memory and set dim_ and data_ to zero.

dim() → int
Returns:This vector dimension
from_other(src:CuDoublePtrArray) → CuDoublePtrArray

Calls C++ function std::unique_ptr<::kaldi::CuArray<double *>> ::kaldi::CuArray<double *>::CuArray(::kaldi::CuArray<double *>)

from_size(dim:int, resize_type:MatrixResizeType=default) → CuDoublePtrArray

Calls C++ function std::unique_ptr<::kaldi::CuArray<double *>> ::kaldi::CuArray<double *>::CuArray(int, ::kaldi::MatrixResizeType)

max() → float
Returns:Maximum value
min() → float
Returns:Minimum value
resize(dim:int, resize_type:MatrixResizeType=default)

Allocate the memory.

set_zero()

Sets the memory for the object to zero.

class kaldi.cudamatrix.CuDoubleSubMatrix

CLIF wrapper for ::kaldi::CuSubMatrix<double>

add(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Add(double)

add_cols(src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddCols(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

add_diag_vec_mat(alpha:float, v:CuDoubleVectorBase, M:CuDoubleMatrixBase, transM:MatrixTransposeType, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddDiagVecMat(double, ::kaldi::CuVectorBase<double>, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, double)

add_elements(alpha:float, input:list<DoubleMatrixElement>)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddElements(double, ::std::vector< ::MatrixElement<double> >)

add_mat(alpha:float, A:CuDoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMat(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType)

add_mat_blocks(alpha:float, A:CuDoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMatBlocks(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType)

add_mat_diag_vec(alpha:float, M:CuDoubleMatrixBase, transM:MatrixTransposeType, v:CuDoubleVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMatDiagVec(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, ::kaldi::CuVectorBase<double>, double)

add_mat_mat(alpha:float, A:CuDoubleMatrixBase, transA:MatrixTransposeType, B:CuDoubleMatrixBase, transB:MatrixTransposeType, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMatMat(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, double)

add_mat_mat_elements(alpha:float, A:CuDoubleMatrixBase, B:CuDoubleMatrixBase, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddMatMatElements(double, ::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, double)

add_row_ranges(src:CuDoubleMatrixBase, indexes:CuIntPairArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddRowRanges(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray< ::Int32Pair>)

add_rows(alpha:float, src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddRows(double, ::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

add_to_diag(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddToDiag(double)

add_to_rows(alpha:float, dst:CuDoublePtrArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddToRows(double, ::kaldi::CuArray<double *>)

add_vec_to_cols(alpha:float, col:CuDoubleVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddVecToCols(double, ::kaldi::CuVectorBase<double>, double)

add_vec_to_rows(alpha:float, row:CuDoubleVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddVecToRows(double, ::kaldi::CuVectorBase<double>, double)

add_vec_vec(alpha:float, x:CuDoubleVectorBase, y:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::AddVecVec(double, ::kaldi::CuVectorBase<double>, ::kaldi::CuVectorBase<double>)

apply_ceiling(ceiling_val:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyCeiling(double)

apply_exp()

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyExp()

apply_floor(floor_val:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyFloor(double)

apply_heaviside()

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyHeaviside()

apply_log()

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyLog()

apply_log_soft_max_per_row(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyLogSoftMaxPerRow(::kaldi::CuMatrixBase<double>)

apply_pow(power:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyPow(double)

apply_pow_abs(power:float, include_sign:bool=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplyPowAbs(double, bool)

apply_soft_max_per_row(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ApplySoftMaxPerRow(::kaldi::CuMatrixBase<double>)

approx_equal(other:CuDoubleMatrixBase, tol:float=default) → bool

Calls C++ function bool ::kaldi::CuMatrixBase<double>::ApproxEqual(::kaldi::CuMatrixBase<double>, float)

cholesky(inv_cholesky:CuDoubleMatrixBase=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Cholesky(::kaldi::CuMatrixBase<double> *)

copy_col_from_cu_vec(v:CuDoubleVectorBase, col:int)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyColFromVec(::kaldi::CuVectorBase<double>, int)

copy_cols(src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyCols(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

copy_cols_from_cu_vec(v:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyColsFromVec(::kaldi::CuVectorBase<double>)

copy_from_cu_mat(src:CuDoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyFromMat(::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType)

copy_from_mat(src:DoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyFromMat(::kaldi::MatrixBase<double>, ::kaldi::MatrixTransposeType)

copy_lower_to_upper()

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyLowerToUpper()

copy_rows(src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyRows(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

copy_rows_from_cu_vec(v:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyRowsFromVec(::kaldi::CuVectorBase<double>)

copy_rows_from_vec(v:DoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyRowsFromVec(::kaldi::VectorBase<double>)

copy_to_mat(dst:DoubleMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyToMat(::kaldi::MatrixBase<double> *, ::kaldi::MatrixTransposeType)

copy_to_rows(dst:CuDoublePtrArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyToRows(::kaldi::CuArray<double *>)

copy_upper_to_lower()

Calls C++ function void ::kaldi::CuMatrixBase<double>::CopyUpperToLower()

diff_group_pnorm(in_value:CuDoubleMatrixBase, out_value:CuDoubleMatrixBase, out_deriv:CuDoubleMatrixBase, power:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffGroupPnorm(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, double)

diff_log_softmax_per_row(out_value:CuDoubleMatrixBase, out_deriv:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffLogSoftmaxPerRow(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

diff_parametric_relu(value:CuDoubleMatrixBase, diff:CuDoubleMatrixBase, alpha:CuDoubleVectorBase, beta:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffParametricRelu(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, ::kaldi::CuVectorBase<double>, ::kaldi::CuVectorBase<double>)

diff_sigmoid(value:CuDoubleMatrixBase, diff:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffSigmoid(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

diff_softmax_per_row(value:CuDoubleMatrixBase, diff:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffSoftmaxPerRow(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

diff_tanh(value:CuDoubleMatrixBase, diff:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffTanh(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

diff_xent(tgt:CuArray) → CuDoubleVector

Calls C++ function void ::kaldi::CuMatrixBase<double>::DiffXent(::kaldi::CuArray<int>, ::kaldi::CuVector<double>*)

dim() → MatrixDim

Calls C++ function ::MatrixDim_ ::kaldi::CuMatrixBase<double>::Dim()

div_elements(A:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DivElements(::kaldi::CuMatrixBase<double>)

div_rows_vec(div:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::DivRowsVec(::kaldi::CuVectorBase<double>)

find_row_max_id() → CuArray

Calls C++ function void ::kaldi::CuMatrixBase<double>::FindRowMaxId(::kaldi::CuArray<int>*)

frobenius_norm() → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::FrobeniusNorm()

from_other(other:CuDoubleSubMatrix) → CuDoubleSubMatrix

Calls C++ function std::unique_ptr<::kaldi::CuSubMatrix<double>> ::kaldi::CuSubMatrix<double>::CuSubMatrix(::kaldi::CuSubMatrix<double>)

group_max(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::GroupMax(::kaldi::CuMatrixBase<double>)

group_max_deriv(input:CuDoubleMatrixBase, output:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::GroupMaxDeriv(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

group_pnorm(src:CuDoubleMatrixBase, pow:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::GroupPnorm(::kaldi::CuMatrixBase<double>, double)

heaviside(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Heaviside(::kaldi::CuMatrixBase<double>)

invert_elements()

Calls C++ function void ::kaldi::CuMatrixBase<double>::InvertElements()

is_unit(tol:float=default) → bool

Calls C++ function bool ::kaldi::CuMatrixBase<double>::IsUnit(double)

max() → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::Max()

max_elementwise(A:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Max(::kaldi::CuMatrixBase<double>)

min() → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::Min()

min_elementwise(A:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Min(::kaldi::CuMatrixBase<double>)

mul_cols_vec(scale:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulColsVec(::kaldi::CuVectorBase<double>)

mul_elements(A:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulElements(::kaldi::CuMatrixBase<double>)

mul_rows(src:CuDoubleMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulRows(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray<int>)

mul_rows_group_mat(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulRowsGroupMat(::kaldi::CuMatrixBase<double>)

mul_rows_vec(scale:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::MulRowsVec(::kaldi::CuVectorBase<double>)

num_cols() → int

Calls C++ function int ::kaldi::CuMatrixBase<double>::NumCols()

num_rows() → int

Calls C++ function int ::kaldi::CuMatrixBase<double>::NumRows()

parametric_relu(src:CuDoubleMatrixBase, alpha:CuDoubleVectorBase, beta:CuDoubleVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::ParametricRelu(::kaldi::CuMatrixBase<double>, ::kaldi::CuVectorBase<double>, ::kaldi::CuVectorBase<double>)

scale(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Scale(double)

set(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Set(double)

set_mat_mat_div_mat(A:CuDoubleMatrixBase, B:CuDoubleMatrixBase, C:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetMatMatDivMat(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

set_rand_uniform()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetRandUniform()

set_randn()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetRandn()

set_zero()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetZero()

set_zero_above_diag()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SetZeroAboveDiag()

sigmoid(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Sigmoid(::kaldi::CuMatrixBase<double>)

size_in_bytes() → int

Calls C++ function int ::kaldi::CuMatrixBase<double>::SizeInBytes()

soft_hinge(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::SoftHinge(::kaldi::CuMatrixBase<double>)

stride() → int

Calls C++ function int ::kaldi::CuMatrixBase<double>::Stride()

sum() → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::Sum()

sum_column_ranges(src:CuDoubleMatrixBase, indexes:CuIntPairArray)

Calls C++ function void ::kaldi::CuMatrixBase<double>::SumColumnRanges(::kaldi::CuMatrixBase<double>, ::kaldi::CuArray< ::Int32Pair>)

sym_add_mat2(alpha:float, M:CuDoubleMatrixBase, transA:MatrixTransposeType, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<double>::SymAddMat2(double, ::kaldi::CuMatrixBase<double>, ::kaldi::MatrixTransposeType, double)

sym_invert_pos_def()

Calls C++ function void ::kaldi::CuMatrixBase<double>::SymInvertPosDef()

tanh(src:CuDoubleMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Tanh(::kaldi::CuMatrixBase<double>)

trace(check_square:bool=default) → float

Calls C++ function double ::kaldi::CuMatrixBase<double>::Trace(bool)

write(os:ostream, binary:bool)

Calls C++ function void ::kaldi::CuMatrixBase<double>::Write(::std::basic_ostream<char, ::std::char_traits<char> >, bool)

class kaldi.cudamatrix.CuDoubleSubVector

CLIF wrapper for ::kaldi::CuSubVector<double>

add(value:float)

Adds a constant to this vector

add_vec(alpha:float, vec:CuDoubleVectorBase, beta:float=default)

Computes this <– beta * this + alpha * vec

add_vec_vec(alpha:float, v:CuDoubleVectorBase, r:CuDoubleVectorBase, beta:float)

Computes this <– alpha * v + beta * r

apply_ceiling(ceiling_val:float) → int

Applies ceiling to this vector’s elements

Returns:The number of elements set to ceiling value.
apply_ceiling_no_count(ceiling_val:float)

Applies ceiling to this vector’s elements

apply_exp()

Applies exp to this vector’s elements

apply_floor(floor_val:float) → int

Applies floor to this vector’s elements

Returns:The number of elements set to floor value.
apply_floor_no_count(floor_val:float)

Applies floor to this vector’s elements

apply_log()

Applies log to this vector’s elements

apply_pow(power:float)

Applies pow to this vector’s elements

apply_softmax()

Applies a softmax to this vector’s elements

approx_equal(other:CuDoubleVectorBase, tol:float=default) → bool

Returns true if ||this - other|| <= tol

copy_from_cu_vec(src:CuDoubleVectorBase)

Copies data from other CuVector

copy_from_vec(src:DoubleVectorBase)

Copies data from other :class:kaldi.matrix.VectorBase

copy_rows_from_mat(M:DoubleMatrixBase)

Copies data from :class:kaldi.matrix.MatrixBase

copy_to_vec(dst:DoubleVectorBase)

Copies data to :class:kaldi.matrix.VectorBase

dim() → int

Returns this vector dimension

from_other(other:CuDoubleSubVector) → CuDoubleSubVector

Calls C++ function std::unique_ptr<::kaldi::CuSubVector<double>> ::kaldi::CuSubVector<double>::CuSubVector(::kaldi::CuSubVector<double>)

invert_elements()

Inverts this vector’s elements

max() → float
Returns:Maximum value of this vector
min() → float
Returns:Minimum value of this vector
mul_elements(v:CuDoubleVectorBase)

Multipy element-by-element by another vector.

norm(p:float) → float
Returns:p-norm of this vector
replace_value(orig:float, changed:float)

Set each element to y = (x == orig ? changed : x).

scale(value:float)

Multiplies this vector’s data by a constant

set(value:float)

Sets this vector’s data to a constant

set_rand_uniform()

Sets this vector’s elements to values from random uniform

set_randn()

Sets this vector’s elements to random [0,1)

set_zero()

Sets this vector’s data to zero

sum() → float

Sum this vector’s elements

class kaldi.cudamatrix.CuDoubleVector

CLIF wrapper for ::kaldi::CuVector<double>

add(value:float)

Adds a constant to this vector

add_vec(alpha:float, vec:CuDoubleVectorBase, beta:float=default)

Computes this <– beta * this + alpha * vec

add_vec_vec(alpha:float, v:CuDoubleVectorBase, r:CuDoubleVectorBase, beta:float)

Computes this <– alpha * v + beta * r

apply_ceiling(ceiling_val:float) → int

Applies ceiling to this vector’s elements

Returns:The number of elements set to ceiling value.
apply_ceiling_no_count(ceiling_val:float)

Applies ceiling to this vector’s elements

apply_exp()

Applies exp to this vector’s elements

apply_floor(floor_val:float) → int

Applies floor to this vector’s elements

Returns:The number of elements set to floor value.
apply_floor_no_count(floor_val:float)

Applies floor to this vector’s elements

apply_log()

Applies log to this vector’s elements

apply_pow(power:float)

Applies pow to this vector’s elements

apply_softmax()

Applies a softmax to this vector’s elements

approx_equal(other:CuDoubleVectorBase, tol:float=default) → bool

Returns true if ||this - other|| <= tol

copy_from_cu_vec(src:CuDoubleVectorBase)

Copies data from other CuVector

copy_from_vec(src:DoubleVectorBase)

Copies data from other :class:kaldi.matrix.VectorBase

copy_rows_from_mat(M:DoubleMatrixBase)

Copies data from :class:kaldi.matrix.MatrixBase

copy_to_vec(dst:DoubleVectorBase)

Copies data to :class:kaldi.matrix.VectorBase

dim() → int

Returns this vector dimension

from_base(v:CuDoubleVectorBase) → CuDoubleVector

Calls C++ function std::unique_ptr<::kaldi::CuVector<double>> ::kaldi::CuVector<double>::CuVector(::kaldi::CuVectorBase<double>)

from_size(dim:int, resize_type:MatrixResizeType=default) → CuDoubleVector

Calls C++ function std::unique_ptr<::kaldi::CuVector<double>> ::kaldi::CuVector<double>::CuVector(int, ::kaldi::MatrixResizeType)

from_vector(v:DoubleVectorBase) → CuDoubleVector

Calls C++ function std::unique_ptr<::kaldi::CuVector<double>> ::kaldi::CuVector<double>::CuVector(::kaldi::VectorBase<double>)

invert_elements()

Inverts this vector’s elements

max() → float
Returns:Maximum value of this vector
min() → float
Returns:Minimum value of this vector
mul_elements(v:CuDoubleVectorBase)

Multipy element-by-element by another vector.

norm(p:float) → float
Returns:p-norm of this vector
read(is:istream, binary:bool)

I/O

replace_value(orig:float, changed:float)

Set each element to y = (x == orig ? changed : x).

resize(dim:int, resize_type:MatrixResizeType=default)

Resize this vector to dim

scale(value:float)

Multiplies this vector’s data by a constant

set(value:float)

Sets this vector’s data to a constant

set_rand_uniform()

Sets this vector’s elements to values from random uniform

set_randn()

Sets this vector’s elements to random [0,1)

set_zero()

Sets this vector’s data to zero

sum() → float

Sum this vector’s elements

swap(vec:DoubleVector)

Swaps the contents of this and vec. Shallow swap.

write(os:ostream, binary:bool)

I/O

class kaldi.cudamatrix.CuFloatPtrArray

CLIF wrapper for ::kaldi::CuArray<float *>

copy_from_array(src:CuFloatPtrArray)

This function resizes if needed.

destroy()

Deallocate the memory and set dim_ and data_ to zero.

dim() → int
Returns:This vector dimension
from_other(src:CuFloatPtrArray) → CuFloatPtrArray

Calls C++ function std::unique_ptr<::kaldi::CuArray<float *>> ::kaldi::CuArray<float *>::CuArray(::kaldi::CuArray<float *>)

from_size(dim:int, resize_type:MatrixResizeType=default) → CuFloatPtrArray

Calls C++ function std::unique_ptr<::kaldi::CuArray<float *>> ::kaldi::CuArray<float *>::CuArray(int, ::kaldi::MatrixResizeType)

max() → float
Returns:Maximum value
min() → float
Returns:Minimum value
resize(dim:int, resize_type:MatrixResizeType=default)

Allocate the memory.

set_zero()

Sets the memory for the object to zero.

class kaldi.cudamatrix.CuIntPairArray

CLIF wrapper for ::kaldi::CuArray< ::Int32Pair>

add(value:IntPair)

Add a constant value

copy_from_array(src:CuIntPairArray)

This function resizes if needed.

copy_from_vec(src:list<IntPair>)

This function resizes if needed.

copy_to_vec() → list<IntPair>

This function resizes dst if needed.

destroy()

Deallocate the memory and set dim_ and data_ to zero.

dim() → int
Returns:This vector dimension
from_other(src:CuIntPairArray) → CuIntPairArray

Calls C++ function std::unique_ptr<::kaldi::CuArray< ::Int32Pair>> ::kaldi::CuArray<Int32Pair>::CuArray(::kaldi::CuArray< ::Int32Pair>)

from_size(dim:int, resize_type:MatrixResizeType=default) → CuIntPairArray

Calls C++ function std::unique_ptr<::kaldi::CuArray< ::Int32Pair>> ::kaldi::CuArray<Int32Pair>::CuArray(int, ::kaldi::MatrixResizeType)

from_vector(src:list<IntPair>) → CuIntPairArray

Calls C++ function std::unique_ptr<::kaldi::CuArray< ::Int32Pair>> ::kaldi::CuArray<Int32Pair>::CuArray(::std::vector< ::Int32Pair>)

resize(dim:int, resize_type:MatrixResizeType=default)

Allocate the memory.

set(value:IntPair)

Set to a constant value.

set_zero()

Sets the memory for the object to zero.

class kaldi.cudamatrix.CuMatrix

CLIF wrapper for ::kaldi::CuMatrix<float>

add(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Add(float)

add_cols(src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddCols(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

add_diag_vec_mat(alpha:float, v:CuVectorBase, M:CuMatrixBase, transM:MatrixTransposeType, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddDiagVecMat(float, ::kaldi::CuVectorBase<float>, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, float)

add_elements(alpha:float, input:list<MatrixElement>)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddElements(float, ::std::vector< ::MatrixElement<float> >)

add_mat(alpha:float, A:CuMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMat(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType)

add_mat_blocks(alpha:float, A:CuMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMatBlocks(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType)

add_mat_diag_vec(alpha:float, M:CuMatrixBase, transM:MatrixTransposeType, v:CuVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMatDiagVec(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, ::kaldi::CuVectorBase<float>, float)

add_mat_mat(alpha:float, A:CuMatrixBase, transA:MatrixTransposeType, B:CuMatrixBase, transB:MatrixTransposeType, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMatMat(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, float)

add_mat_mat_elements(alpha:float, A:CuMatrixBase, B:CuMatrixBase, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMatMatElements(float, ::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, float)

add_row_ranges(src:CuMatrixBase, indexes:CuIntPairArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddRowRanges(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray< ::Int32Pair>)

add_rows(alpha:float, src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddRows(float, ::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

add_to_diag(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddToDiag(float)

add_to_rows(alpha:float, dst:CuFloatPtrArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddToRows(float, ::kaldi::CuArray<float *>)

add_vec_to_cols(alpha:float, col:CuVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddVecToCols(float, ::kaldi::CuVectorBase<float>, float)

add_vec_to_rows(alpha:float, row:CuVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddVecToRows(float, ::kaldi::CuVectorBase<float>, float)

add_vec_vec(alpha:float, x:CuVectorBase, y:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddVecVec(float, ::kaldi::CuVectorBase<float>, ::kaldi::CuVectorBase<float>)

apply_ceiling(ceiling_val:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyCeiling(float)

apply_exp()

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyExp()

apply_exp_limited(lower_limit:float, upper_limit:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyExpLimited(float, float)

apply_floor(floor_val:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyFloor(float)

apply_heaviside()

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyHeaviside()

apply_log()

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyLog()

apply_log_soft_max_per_row(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyLogSoftMaxPerRow(::kaldi::CuMatrixBase<float>)

apply_pow(power:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyPow(float)

apply_pow_abs(power:float, include_sign:bool=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyPowAbs(float, bool)

apply_soft_max_per_row(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplySoftMaxPerRow(::kaldi::CuMatrixBase<float>)

approx_equal(other:CuMatrixBase, tol:float=default) → bool

Calls C++ function bool ::kaldi::CuMatrixBase<float>::ApproxEqual(::kaldi::CuMatrixBase<float>, float)

cholesky(inv_cholesky:CuMatrixBase=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Cholesky(::kaldi::CuMatrixBase<float> *)

comp_objf_and_deriv(elements:list<MatrixElement>, A:CuMatrix) -> (tot_objf:float, tot_weight:float)

Calls C++ function void ::kaldi::CuMatrix<float>::CompObjfAndDeriv(::std::vector< ::MatrixElement<float> >, ::kaldi::CuMatrix<float>, float*, float*)

copy_col_from_cu_vec(v:CuVectorBase, col:int)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyColFromVec(::kaldi::CuVectorBase<float>, int)

copy_cols(src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyCols(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

copy_cols_from_cu_vec(v:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyColsFromVec(::kaldi::CuVectorBase<float>)

copy_from_cu_mat(src:CuMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyFromMat(::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType)

copy_from_mat(src:MatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyFromMat(::kaldi::MatrixBase<float>, ::kaldi::MatrixTransposeType)

copy_lower_to_upper()

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyLowerToUpper()

copy_rows(src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyRows(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

copy_rows_from_cu_vec(v:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyRowsFromVec(::kaldi::CuVectorBase<float>)

copy_rows_from_vec(v:VectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyRowsFromVec(::kaldi::VectorBase<float>)

copy_to_mat(dst:MatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyToMat(::kaldi::MatrixBase<float> *, ::kaldi::MatrixTransposeType)

copy_to_rows(dst:CuFloatPtrArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyToRows(::kaldi::CuArray<float *>)

copy_upper_to_lower()

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyUpperToLower()

diff_group_pnorm(in_value:CuMatrixBase, out_value:CuMatrixBase, out_deriv:CuMatrixBase, power:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffGroupPnorm(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, float)

diff_log_softmax_per_row(out_value:CuMatrixBase, out_deriv:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffLogSoftmaxPerRow(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

diff_parametric_relu(value:CuMatrixBase, diff:CuMatrixBase, alpha:CuVectorBase, beta:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffParametricRelu(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, ::kaldi::CuVectorBase<float>, ::kaldi::CuVectorBase<float>)

diff_sigmoid(value:CuMatrixBase, diff:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffSigmoid(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

diff_softmax_per_row(value:CuMatrixBase, diff:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffSoftmaxPerRow(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

diff_tanh(value:CuMatrixBase, diff:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffTanh(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

diff_xent(tgt:CuArray) → CuVector

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffXent(::kaldi::CuArray<int>, ::kaldi::CuVector<float>*)

dim() → MatrixDim

Calls C++ function ::MatrixDim_ ::kaldi::CuMatrixBase<float>::Dim()

div_elements(A:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DivElements(::kaldi::CuMatrixBase<float>)

div_rows_vec(div:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DivRowsVec(::kaldi::CuVectorBase<float>)

find_row_max_id() → CuArray

Calls C++ function void ::kaldi::CuMatrixBase<float>::FindRowMaxId(::kaldi::CuArray<int>*)

frobenius_norm() → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::FrobeniusNorm()

from_matrix(other:MatrixBase, trans:MatrixTransposeType=default) → CuMatrix

Calls C++ function std::unique_ptr<::kaldi::CuMatrix<float>> ::kaldi::CuMatrix<float>::CuMatrix(::kaldi::MatrixBase<float>, ::kaldi::MatrixTransposeType)

from_other(other:CuMatrixBase, trans:MatrixTransposeType=default) → CuMatrix

Calls C++ function std::unique_ptr<::kaldi::CuMatrix<float>> ::kaldi::CuMatrix<float>::CuMatrix(::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType)

from_size(rows:int, cols:int, resize_type:MatrixResizeType=default, stride_type:MatrixStrideType=default) → CuMatrix

Calls C++ function std::unique_ptr<::kaldi::CuMatrix<float>> ::kaldi::CuMatrix<float>::CuMatrix(int, int, ::kaldi::MatrixResizeType, ::kaldi::MatrixStrideType)

group_max(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::GroupMax(::kaldi::CuMatrixBase<float>)

group_max_deriv(input:CuMatrixBase, output:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::GroupMaxDeriv(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

group_pnorm(src:CuMatrixBase, pow:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::GroupPnorm(::kaldi::CuMatrixBase<float>, float)

heaviside(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Heaviside(::kaldi::CuMatrixBase<float>)

invert_elements()

Calls C++ function void ::kaldi::CuMatrixBase<float>::InvertElements()

is_unit(tol:float=default) → bool

Calls C++ function bool ::kaldi::CuMatrixBase<float>::IsUnit(float)

max() → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::Max()

max_elementwise(A:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Max(::kaldi::CuMatrixBase<float>)

min() → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::Min()

min_elementwise(A:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Min(::kaldi::CuMatrixBase<float>)

mul_cols_vec(scale:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulColsVec(::kaldi::CuVectorBase<float>)

mul_elements(A:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulElements(::kaldi::CuMatrixBase<float>)

mul_rows(src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulRows(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

mul_rows_group_mat(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulRowsGroupMat(::kaldi::CuMatrixBase<float>)

mul_rows_vec(scale:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulRowsVec(::kaldi::CuVectorBase<float>)

num_cols() → int

Calls C++ function int ::kaldi::CuMatrixBase<float>::NumCols()

num_rows() → int

Calls C++ function int ::kaldi::CuMatrixBase<float>::NumRows()

parametric_relu(src:CuMatrixBase, alpha:CuVectorBase, beta:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ParametricRelu(::kaldi::CuMatrixBase<float>, ::kaldi::CuVectorBase<float>, ::kaldi::CuVectorBase<float>)

read(is:istream, binary:bool)

Calls C++ function void ::kaldi::CuMatrix<float>::Read(::std::basic_istream<char, ::std::char_traits<char> >, bool)

resize(rows:int, cols:int, resize_type:MatrixResizeType=default, stride_type:MatrixStrideType=default)

Calls C++ function void ::kaldi::CuMatrix<float>::Resize(int, int, ::kaldi::MatrixResizeType, ::kaldi::MatrixStrideType)

scale(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Scale(float)

set(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Set(float)

set_mat_mat_div_mat(A:CuMatrixBase, B:CuMatrixBase, C:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetMatMatDivMat(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

set_rand_uniform()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetRandUniform()

set_randn()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetRandn()

set_zero()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetZero()

set_zero_above_diag()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetZeroAboveDiag()

sigmoid(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Sigmoid(::kaldi::CuMatrixBase<float>)

size_in_bytes() → int

Calls C++ function int ::kaldi::CuMatrixBase<float>::SizeInBytes()

soft_hinge(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::SoftHinge(::kaldi::CuMatrixBase<float>)

stride() → int

Calls C++ function int ::kaldi::CuMatrixBase<float>::Stride()

sum() → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::Sum()

sum_column_ranges(src:CuMatrixBase, indexes:CuIntPairArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::SumColumnRanges(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray< ::Int32Pair>)

swap(mat:CuMatrix)

Calls C++ function void ::kaldi::CuMatrix<float>::Swap(::kaldi::CuMatrix<float> *)

swap_with_matrix(mat:Matrix)

Calls C++ function void ::kaldi::CuMatrix<float>::Swap(::kaldi::Matrix<float> *)

sym_add_mat2(alpha:float, M:CuMatrixBase, transA:MatrixTransposeType, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::SymAddMat2(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, float)

sym_invert_pos_def()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SymInvertPosDef()

tanh(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Tanh(::kaldi::CuMatrixBase<float>)

trace(check_square:bool=default) → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::Trace(bool)

transpose()

Calls C++ function void ::kaldi::CuMatrix<float>::Transpose()

write(os:ostream, binary:bool)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Write(::std::basic_ostream<char, ::std::char_traits<char> >, bool)

class kaldi.cudamatrix.CuSparseMatrix

This class defines a Sparse CUDA Matrix.

copy_elements_to_vec(vec:CuVectorBase)

Copies the nonzero elements of the matrix to the vector other.

Parameters:

vec (CuVectorBase) – A CUDA vector to store the nonzero elements of self

Raises:
  • Error if the size of other is different than the number of nonzero
  • elements of self
copy_from_smat_(smat:CuSparseMatrix, trans:MatrixTransposeType=default)

Copy data from another sparse CUDA matrix. Will resize if necessary.

Parameters:
copy_to_mat(dest:CuMatrixBase, trans:MatrixTransposeType=default)

Copies elements to a CUDA matrix.

Parameters:
  • dest (CuMatrixBase) – The matrix to copy to.
  • trans (MatrixTransposeType) – transpose or not.
copy_to_smat(smat:SparseMatrix)

Copy data to a sparse matrix.

Parameters:smat (SparseMatrix) – The sparse matrix to copy to.
frobenius_norm() → float

Computes and returns the Frobenius norm.

from_cpu(smat:SparseMatrix) → CuSparseMatrix

Initialization by copying the elements of a sparse matrix.

Parameters:smat (SparseMatrix) – A sparse matrix.
from_indexes(indexes:CuArray, dim:int, trans:MatrixTransposeType=default) → CuSparseMatrix

Initialization from an array of indexes.

If trans == NO_TRANS, construct a sparse matrix with num-rows == indexes.Dim() and num-cols = ‘dim’. ‘indexes’ is expected to contain elements in the range [0, dim - 1]. Each row ‘i’ of self after calling the constructor will contain a single element at column-index indexes[i] with value 1.0.

If trans == TRANS, the result will be the transpose of the sparse matrix described above.

Parameters:
  • indexes (CuArray) – The CUDA array of indexes.
  • dim (int) – The column (or row) dimension.
  • trans (MatrixTransposeType) – Transpose or not.
from_indexes_and_weights(indexes:CuArray, weights:CuVectorBase, dim:int, trans:MatrixTransposeType=default) → CuSparseMatrix

Initialization from an array of indexes and an array of weights.

Requires indexes.Dim() == weights.Dim(). If trans == NO_TRANS, construct a sparse matrix with num-rows == indexes.Dim() and num-cols = ‘dim’. ‘indexes’ is expected to contain elements in the range [0, dim - 1]. Each row ‘i’ of *this after calling the constructor will contain a single element at column-index indexes[i] with value weights[i]. If trans == TRANS, the result will be the transpose of the sparse matrix described above.

Parameters:
  • indexes (CuArray) – The CUDA array of indexes.
  • weights (CuVectorBase) – The CUDA vector of weights.
  • dim (int) – The column (or row) dimension.
  • trans (MatrixTransposeType) – Transpose or not.
from_other(smat:CuSparseMatrix, trans:MatrixTransposeType=default) → CuSparseMatrix

Initialization by copying the elements of another sparse CUDA matrix.

Parameters:
num_cols

Number of columns (zero for empty matrix).

num_elements() → int

Returns the number of nonzero elements.

num_rows

Number of rows (zero for empty matrix).

read_(is:istream, binary:bool)

Reads from C++ stream.

Parameters:
  • is (istream) – The input straem.
  • binary (bool) – If the stream is binary.
select_rows_(row_indexes:CuArray, smat_other:CuSparseMatrix)

Sets self to a subset of the rows of another sparse CUDA matrix.

Parameters:
  • row_indexes (CuArray) – The rows to select.
  • smat_other (CuSparseMatrix) – The other sparse CUDA matrix.
set_randn_(zero_prob:float)

Sets up to a pseudo-randomly initialized matrix, with each element zero with probability zero_prob and else normally distributed.

sum() → float

Returns the sum of the elememts.

swap_(other:CuSparseMatrix)

Swaps the contents with another sparse CUDA matrix.

Shallow swap.

swap_with_cpu_(other:SparseMatrix)

Swaps the contents with a sparse matrix.

Shallow swap.

write(os:ostream, binary:bool)

Writes to C++ stream.

Parameters:
  • os (ostream) – The output straem.
  • binary (bool) – If the stream is binary.
class kaldi.cudamatrix.CuSubMatrix

CLIF wrapper for ::kaldi::CuSubMatrix<float>

add(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Add(float)

add_cols(src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddCols(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

add_diag_vec_mat(alpha:float, v:CuVectorBase, M:CuMatrixBase, transM:MatrixTransposeType, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddDiagVecMat(float, ::kaldi::CuVectorBase<float>, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, float)

add_elements(alpha:float, input:list<MatrixElement>)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddElements(float, ::std::vector< ::MatrixElement<float> >)

add_mat(alpha:float, A:CuMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMat(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType)

add_mat_blocks(alpha:float, A:CuMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMatBlocks(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType)

add_mat_diag_vec(alpha:float, M:CuMatrixBase, transM:MatrixTransposeType, v:CuVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMatDiagVec(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, ::kaldi::CuVectorBase<float>, float)

add_mat_mat(alpha:float, A:CuMatrixBase, transA:MatrixTransposeType, B:CuMatrixBase, transB:MatrixTransposeType, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMatMat(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, float)

add_mat_mat_elements(alpha:float, A:CuMatrixBase, B:CuMatrixBase, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddMatMatElements(float, ::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, float)

add_row_ranges(src:CuMatrixBase, indexes:CuIntPairArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddRowRanges(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray< ::Int32Pair>)

add_rows(alpha:float, src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddRows(float, ::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

add_to_diag(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddToDiag(float)

add_to_rows(alpha:float, dst:CuFloatPtrArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddToRows(float, ::kaldi::CuArray<float *>)

add_vec_to_cols(alpha:float, col:CuVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddVecToCols(float, ::kaldi::CuVectorBase<float>, float)

add_vec_to_rows(alpha:float, row:CuVectorBase, beta:float=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddVecToRows(float, ::kaldi::CuVectorBase<float>, float)

add_vec_vec(alpha:float, x:CuVectorBase, y:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::AddVecVec(float, ::kaldi::CuVectorBase<float>, ::kaldi::CuVectorBase<float>)

apply_ceiling(ceiling_val:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyCeiling(float)

apply_exp()

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyExp()

apply_exp_limited(lower_limit:float, upper_limit:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyExpLimited(float, float)

apply_floor(floor_val:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyFloor(float)

apply_heaviside()

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyHeaviside()

apply_log()

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyLog()

apply_log_soft_max_per_row(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyLogSoftMaxPerRow(::kaldi::CuMatrixBase<float>)

apply_pow(power:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyPow(float)

apply_pow_abs(power:float, include_sign:bool=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplyPowAbs(float, bool)

apply_soft_max_per_row(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ApplySoftMaxPerRow(::kaldi::CuMatrixBase<float>)

approx_equal(other:CuMatrixBase, tol:float=default) → bool

Calls C++ function bool ::kaldi::CuMatrixBase<float>::ApproxEqual(::kaldi::CuMatrixBase<float>, float)

cholesky(inv_cholesky:CuMatrixBase=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Cholesky(::kaldi::CuMatrixBase<float> *)

copy_col_from_cu_vec(v:CuVectorBase, col:int)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyColFromVec(::kaldi::CuVectorBase<float>, int)

copy_cols(src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyCols(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

copy_cols_from_cu_vec(v:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyColsFromVec(::kaldi::CuVectorBase<float>)

copy_from_cu_mat(src:CuMatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyFromMat(::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType)

copy_from_mat(src:MatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyFromMat(::kaldi::MatrixBase<float>, ::kaldi::MatrixTransposeType)

copy_lower_to_upper()

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyLowerToUpper()

copy_rows(src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyRows(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

copy_rows_from_cu_vec(v:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyRowsFromVec(::kaldi::CuVectorBase<float>)

copy_rows_from_vec(v:VectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyRowsFromVec(::kaldi::VectorBase<float>)

copy_to_mat(dst:MatrixBase, trans:MatrixTransposeType=default)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyToMat(::kaldi::MatrixBase<float> *, ::kaldi::MatrixTransposeType)

copy_to_rows(dst:CuFloatPtrArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyToRows(::kaldi::CuArray<float *>)

copy_upper_to_lower()

Calls C++ function void ::kaldi::CuMatrixBase<float>::CopyUpperToLower()

diff_group_pnorm(in_value:CuMatrixBase, out_value:CuMatrixBase, out_deriv:CuMatrixBase, power:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffGroupPnorm(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, float)

diff_log_softmax_per_row(out_value:CuMatrixBase, out_deriv:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffLogSoftmaxPerRow(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

diff_parametric_relu(value:CuMatrixBase, diff:CuMatrixBase, alpha:CuVectorBase, beta:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffParametricRelu(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, ::kaldi::CuVectorBase<float>, ::kaldi::CuVectorBase<float>)

diff_sigmoid(value:CuMatrixBase, diff:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffSigmoid(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

diff_softmax_per_row(value:CuMatrixBase, diff:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffSoftmaxPerRow(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

diff_tanh(value:CuMatrixBase, diff:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffTanh(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

diff_xent(tgt:CuArray) → CuVector

Calls C++ function void ::kaldi::CuMatrixBase<float>::DiffXent(::kaldi::CuArray<int>, ::kaldi::CuVector<float>*)

dim() → MatrixDim

Calls C++ function ::MatrixDim_ ::kaldi::CuMatrixBase<float>::Dim()

div_elements(A:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DivElements(::kaldi::CuMatrixBase<float>)

div_rows_vec(div:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::DivRowsVec(::kaldi::CuVectorBase<float>)

find_row_max_id() → CuArray

Calls C++ function void ::kaldi::CuMatrixBase<float>::FindRowMaxId(::kaldi::CuArray<int>*)

frobenius_norm() → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::FrobeniusNorm()

from_other(other:CuSubMatrix) → CuSubMatrix

Calls C++ function std::unique_ptr<::kaldi::CuSubMatrix<float>> ::kaldi::CuSubMatrix<float>::CuSubMatrix(::kaldi::CuSubMatrix<float>)

group_max(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::GroupMax(::kaldi::CuMatrixBase<float>)

group_max_deriv(input:CuMatrixBase, output:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::GroupMaxDeriv(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

group_pnorm(src:CuMatrixBase, pow:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::GroupPnorm(::kaldi::CuMatrixBase<float>, float)

heaviside(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Heaviside(::kaldi::CuMatrixBase<float>)

invert_elements()

Calls C++ function void ::kaldi::CuMatrixBase<float>::InvertElements()

is_unit(tol:float=default) → bool

Calls C++ function bool ::kaldi::CuMatrixBase<float>::IsUnit(float)

max() → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::Max()

max_elementwise(A:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Max(::kaldi::CuMatrixBase<float>)

min() → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::Min()

min_elementwise(A:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Min(::kaldi::CuMatrixBase<float>)

mul_cols_vec(scale:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulColsVec(::kaldi::CuVectorBase<float>)

mul_elements(A:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulElements(::kaldi::CuMatrixBase<float>)

mul_rows(src:CuMatrixBase, indexes:CuArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulRows(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray<int>)

mul_rows_group_mat(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulRowsGroupMat(::kaldi::CuMatrixBase<float>)

mul_rows_vec(scale:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::MulRowsVec(::kaldi::CuVectorBase<float>)

num_cols() → int

Calls C++ function int ::kaldi::CuMatrixBase<float>::NumCols()

num_rows() → int

Calls C++ function int ::kaldi::CuMatrixBase<float>::NumRows()

parametric_relu(src:CuMatrixBase, alpha:CuVectorBase, beta:CuVectorBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::ParametricRelu(::kaldi::CuMatrixBase<float>, ::kaldi::CuVectorBase<float>, ::kaldi::CuVectorBase<float>)

scale(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Scale(float)

set(value:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Set(float)

set_mat_mat_div_mat(A:CuMatrixBase, B:CuMatrixBase, C:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetMatMatDivMat(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

set_rand_uniform()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetRandUniform()

set_randn()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetRandn()

set_zero()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetZero()

set_zero_above_diag()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SetZeroAboveDiag()

sigmoid(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Sigmoid(::kaldi::CuMatrixBase<float>)

size_in_bytes() → int

Calls C++ function int ::kaldi::CuMatrixBase<float>::SizeInBytes()

soft_hinge(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::SoftHinge(::kaldi::CuMatrixBase<float>)

stride() → int

Calls C++ function int ::kaldi::CuMatrixBase<float>::Stride()

sum() → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::Sum()

sum_column_ranges(src:CuMatrixBase, indexes:CuIntPairArray)

Calls C++ function void ::kaldi::CuMatrixBase<float>::SumColumnRanges(::kaldi::CuMatrixBase<float>, ::kaldi::CuArray< ::Int32Pair>)

sym_add_mat2(alpha:float, M:CuMatrixBase, transA:MatrixTransposeType, beta:float)

Calls C++ function void ::kaldi::CuMatrixBase<float>::SymAddMat2(float, ::kaldi::CuMatrixBase<float>, ::kaldi::MatrixTransposeType, float)

sym_invert_pos_def()

Calls C++ function void ::kaldi::CuMatrixBase<float>::SymInvertPosDef()

tanh(src:CuMatrixBase)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Tanh(::kaldi::CuMatrixBase<float>)

trace(check_square:bool=default) → float

Calls C++ function float ::kaldi::CuMatrixBase<float>::Trace(bool)

write(os:ostream, binary:bool)

Calls C++ function void ::kaldi::CuMatrixBase<float>::Write(::std::basic_ostream<char, ::std::char_traits<char> >, bool)

class kaldi.cudamatrix.CuSubVector

CLIF wrapper for ::kaldi::CuSubVector<float>

add(value:float)

Adds a constant to this vector

add_vec(alpha:float, vec:CuVectorBase, beta:float=default)

Computes this <– beta * this + alpha * vec

add_vec_vec(alpha:float, v:CuVectorBase, r:CuVectorBase, beta:float)

Computes this <– alpha * v + beta * r

apply_ceiling(ceiling_val:float) → int

Applies ceiling to this vector’s elements

Returns:The number of elements set to ceiling value.
apply_ceiling_no_count(ceiling_val:float)

Applies ceiling to this vector’s elements

apply_exp()

Applies exp to this vector’s elements

apply_floor(floor_val:float) → int

Applies floor to this vector’s elements

Returns:The number of elements set to floor value.
apply_floor_no_count(floor_val:float)

Applies floor to this vector’s elements

apply_log()

Applies log to this vector’s elements

apply_pow(power:float)

Applies pow to this vector’s elements

apply_softmax()

Applies a softmax to this vector’s elements

approx_equal(other:CuVectorBase, tol:float=default) → bool

Returns true if ||this - other|| <= tol

copy_from_cu_vec(src:CuVectorBase)

Copies data from other CuVector

copy_from_vec(src:VectorBase)

Copies data from other :class:kaldi.matrix.VectorBase

copy_rows_from_mat(M:MatrixBase)

Copies data from :class:kaldi.matrix.MatrixBase

copy_to_vec(dst:VectorBase)

Copies data to :class:kaldi.matrix.VectorBase

dim() → int

Returns this vector dimension

from_other(other:CuSubVector) → CuSubVector

Calls C++ function std::unique_ptr<::kaldi::CuSubVector<float>> ::kaldi::CuSubVector<float>::CuSubVector(::kaldi::CuSubVector<float>)

invert_elements()

Inverts this vector’s elements

max() → float
Returns:Maximum value of this vector
min() → float
Returns:Minimum value of this vector
mul_elements(v:CuVectorBase)

Multipy element-by-element by another vector.

norm(p:float) → float
Returns:p-norm of this vector
replace_value(orig:float, changed:float)

Set each element to y = (x == orig ? changed : x).

scale(value:float)

Multiplies this vector’s data by a constant

set(value:float)

Sets this vector’s data to a constant

set_rand_uniform()

Sets this vector’s elements to values from random uniform

set_randn()

Sets this vector’s elements to random [0,1)

set_zero()

Sets this vector’s data to zero

sum() → float

Sum this vector’s elements

class kaldi.cudamatrix.CuTimer

Convenience wrapper for Timer.

This class sets the time only if the verbose level is >= 1. This helps avoid an unnecessary system call if the verbose level is 0 and you won’t be accumulating the timing stats.

elapsed() → float

Returns elapsed time since timer was reset.

new(set_timer:bool) → Timer

Creates and optionally resets the timer to current time.

reset()

Resets the timer to current time.

class kaldi.cudamatrix.CuVector

CLIF wrapper for ::kaldi::CuVector<float>

add(value:float)

Adds a constant to this vector

add_vec(alpha:float, vec:CuVectorBase, beta:float=default)

Computes this <– beta * this + alpha * vec

add_vec_vec(alpha:float, v:CuVectorBase, r:CuVectorBase, beta:float)

Computes this <– alpha * v + beta * r

apply_ceiling(ceiling_val:float) → int

Applies ceiling to this vector’s elements

Returns:The number of elements set to ceiling value.
apply_ceiling_no_count(ceiling_val:float)

Applies ceiling to this vector’s elements

apply_exp()

Applies exp to this vector’s elements

apply_floor(floor_val:float) → int

Applies floor to this vector’s elements

Returns:The number of elements set to floor value.
apply_floor_no_count(floor_val:float)

Applies floor to this vector’s elements

apply_log()

Applies log to this vector’s elements

apply_pow(power:float)

Applies pow to this vector’s elements

apply_softmax()

Applies a softmax to this vector’s elements

approx_equal(other:CuVectorBase, tol:float=default) → bool

Returns true if ||this - other|| <= tol

copy_from_cu_vec(src:CuVectorBase)

Copies data from other CuVector

copy_from_vec(src:VectorBase)

Copies data from other :class:kaldi.matrix.VectorBase

copy_rows_from_mat(M:MatrixBase)

Copies data from :class:kaldi.matrix.MatrixBase

copy_to_vec(dst:VectorBase)

Copies data to :class:kaldi.matrix.VectorBase

dim() → int

Returns this vector dimension

from_base(v:CuVectorBase) → CuVector

Calls C++ function std::unique_ptr<::kaldi::CuVector<float>> ::kaldi::CuVector<float>::CuVector(::kaldi::CuVectorBase<float>)

from_size(dim:int, resize_type:MatrixResizeType=default) → CuVector

Calls C++ function std::unique_ptr<::kaldi::CuVector<float>> ::kaldi::CuVector<float>::CuVector(int, ::kaldi::MatrixResizeType)

from_vector(v:VectorBase) → CuVector

Calls C++ function std::unique_ptr<::kaldi::CuVector<float>> ::kaldi::CuVector<float>::CuVector(::kaldi::VectorBase<float>)

invert_elements()

Inverts this vector’s elements

max() → float
Returns:Maximum value of this vector
min() → float
Returns:Minimum value of this vector
mul_elements(v:CuVectorBase)

Multipy element-by-element by another vector.

norm(p:float) → float
Returns:p-norm of this vector
read(is:istream, binary:bool)

I/O

replace_value(orig:float, changed:float)

Set each element to y = (x == orig ? changed : x).

resize(dim:int, resize_type:MatrixResizeType=default)

Resize this vector to dim

scale(value:float)

Multiplies this vector’s data by a constant

set(value:float)

Sets this vector’s data to a constant

set_rand_uniform()

Sets this vector’s elements to values from random uniform

set_randn()

Sets this vector’s elements to random [0,1)

set_zero()

Sets this vector’s data to zero

sum() → float

Sum this vector’s elements

swap(vec:Vector)

Swaps the contents of this and vec. Shallow swap.

write(os:ostream, binary:bool)

I/O

class kaldi.cudamatrix.DoubleMatrixElement

CLIF wrapper for ::MatrixElement<double>

column

C++ ::int32_cuda MatrixElement<double>.column

row

C++ ::int32_cuda MatrixElement<double>.row

weight

C++ double MatrixElement<double>.weight

class kaldi.cudamatrix.IntPair

CLIF wrapper for ::Int32Pair

first

C++ ::int32_cuda Int32Pair.first

second

C++ ::int32_cuda Int32Pair.second

class kaldi.cudamatrix.MatrixDim

CLIF wrapper for ::MatrixDim_

cols

C++ ::int32_cuda MatrixDim_.cols

rows

C++ ::int32_cuda MatrixDim_.rows

stride

C++ ::int32_cuda MatrixDim_.stride

class kaldi.cudamatrix.MatrixElement

CLIF wrapper for ::MatrixElement<float>

column

C++ ::int32_cuda MatrixElement<float>.column

row

C++ ::int32_cuda MatrixElement<float>.row

weight

C++ float MatrixElement<float>.weight

kaldi.cudamatrix.approx_equal_cu_double_matrix(A:CuDoubleMatrixBase, B:CuDoubleMatrixBase, tol:float=default) → bool

Calls C++ function bool ::kaldi::ApproxEqual(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, double)

kaldi.cudamatrix.approx_equal_cu_double_vector(a:CuDoubleVectorBase, b:CuDoubleVectorBase, tol:float=default) → bool

Calls C++ function bool ::kaldi::ApproxEqual(::kaldi::CuVectorBase<double>, ::kaldi::CuVectorBase<double>, double)

kaldi.cudamatrix.approx_equal_cu_matrix(A:CuMatrixBase, B:CuMatrixBase, tol:float=default) → bool

Calls C++ function bool ::kaldi::ApproxEqual(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, float)

kaldi.cudamatrix.approx_equal_cu_vector(a:CuVectorBase, b:CuVectorBase, tol:float=default) → bool

Calls C++ function bool ::kaldi::ApproxEqual(::kaldi::CuVectorBase<float>, ::kaldi::CuVectorBase<float>, float)

kaldi.cudamatrix.assert_equal_cu_double_matrix(A:CuDoubleMatrixBase, B:CuDoubleMatrixBase, tol:float=default)

Calls C++ function void ::kaldi::AssertEqual(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>, float)

kaldi.cudamatrix.assert_equal_cu_double_vector(a:CuDoubleVectorBase, b:CuDoubleVectorBase, tol:float=default)

Calls C++ function void ::kaldi::AssertEqual(::kaldi::CuVectorBase<double>, ::kaldi::CuVectorBase<double>, double)

kaldi.cudamatrix.assert_equal_cu_matrix(A:CuMatrixBase, B:CuMatrixBase, tol:float=default)

Calls C++ function void ::kaldi::AssertEqual(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>, float)

kaldi.cudamatrix.assert_equal_cu_vector(a:CuVectorBase, b:CuVectorBase, tol:float=default)

Calls C++ function void ::kaldi::AssertEqual(::kaldi::CuVectorBase<float>, ::kaldi::CuVectorBase<float>, float)

kaldi.cudamatrix.cuda_available()[source]

Check if cuda is available.

kaldi.cudamatrix.same_dim_and_stride_cu_double_matrix(M:CuDoubleMatrixBase, N:CuDoubleMatrixBase) → bool

Calls C++ function bool ::kaldi::SameDimAndStride(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

kaldi.cudamatrix.same_dim_and_stride_cu_matrix(M:CuMatrixBase, N:CuMatrixBase) → bool

Calls C++ function bool ::kaldi::SameDimAndStride(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

kaldi.cudamatrix.same_dim_cu_double_matrix(M:CuDoubleMatrixBase, N:CuDoubleMatrixBase) → bool

Calls C++ function bool ::kaldi::SameDim(::kaldi::CuMatrixBase<double>, ::kaldi::CuMatrixBase<double>)

kaldi.cudamatrix.same_dim_cu_matrix(M:CuMatrixBase, N:CuMatrixBase) → bool

Calls C++ function bool ::kaldi::SameDim(::kaldi::CuMatrixBase<float>, ::kaldi::CuMatrixBase<float>)

kaldi.cudamatrix.synchronize_gpu()

Synchronizes threads.

kaldi.cudamatrix.trace_mat_smat(A:CuMatrixBase, B:CuSparseMatrix, trans:MatrixTransposeType=default) → float

If trans==kNoTrans compute Trace(A*B). If trans==kTrans compute Trace(A^T*B)

Parameters:
Raises:

Error in case of dimensionality mismatch