Vector for CUDA computing. More...
#include <matrix-common.h>
Public Member Functions | |
MatrixIndexT | Dim () const |
Dimensions. More... | |
Real * | Data () |
Returns a pointer to the start of the vector's data. More... | |
const Real * | Data () const |
Returns a pointer to the start of the vector's data (const). More... | |
void | CopyFromVec (const CuVectorBase< Real > &src) |
Copy functions; these will crash if the dimension do not match. More... | |
template<typename OtherReal > | |
void | CopyFromVec (const CuVectorBase< OtherReal > &M) |
template<typename OtherReal > | |
void | CopyFromVec (const VectorBase< OtherReal > &src) |
template<typename OtherReal > | |
void | CopyToVec (VectorBase< OtherReal > *dst) const |
void | CopyRowsFromMat (const CuMatrixBase< Real > &M) |
void | CopyRowsFromMat (const MatrixBase< Real > &M) |
void | SetZero () |
Math operations. More... | |
void | Set (Real value) |
void | Add (Real value) |
void | Scale (Real value) |
void | AddVec (Real alpha, const CuVectorBase< Real > &vec, Real beta=1.0) |
template<typename OtherReal > | |
void | AddVec (Real alpha, const CuVectorBase< OtherReal > &vec, Real beta=1.0) |
void | AddRowSumMat (Real alpha, const CuMatrixBase< Real > &mat, Real beta=1.0) |
Sum the rows of the matrix, add to vector. More... | |
void | AddColSumMat (Real alpha, const CuMatrixBase< Real > &mat, Real beta=1.0) |
Sum the columns of the matrix, add to vector. More... | |
void | AddTpVec (const Real alpha, const CuTpMatrix< Real > &M, const MatrixTransposeType trans, const CuVectorBase< Real > &v, const Real beta) |
Add triangular matrix times vector: this <– beta*this + alpha*M*v. More... | |
void | MulTp (const CuTpMatrix< Real > &M, const MatrixTransposeType trans) |
Multiplies this vector by lower-triangular marix: *this <– *this *M. More... | |
bool | ApproxEqual (const CuVectorBase< Real > &other, float tol=0.01) const |
void | InvertElements () |
void | CopyElements (const CuMatrixBase< Real > &mat, const MatrixTransposeType trans, const CuArrayBase< int32 > &elements) |
Copies selected elements from 'mat' to *this. More... | |
void | Floor (const CuVectorBase< Real > &src, Real floor_val, MatrixIndexT *floored_count=NULL) |
void | Ceiling (const CuVectorBase< Real > &src, Real ceiling_val, MatrixIndexT *ceiled_count=NULL) |
void | Pow (const CuVectorBase< Real > &src, Real power) |
void | ApplyFloor (Real floor_val, MatrixIndexT *floored_count=NULL) |
void | ApplyCeiling (Real ceiling_val, MatrixIndexT *ceiled_count=NULL) |
void | ApplyPow (Real power) |
void | ApplySoftMax () |
void | ApplyLogSoftMax () |
void | ApplyExp () |
void | ApplyLog () |
Real | Sum () const |
void | SetRandn () |
void | SetRandUniform () |
CuSubVector< Real > | Range (const MatrixIndexT o, const MatrixIndexT l) |
const CuSubVector< Real > | Range (const MatrixIndexT o, const MatrixIndexT l) const |
void | CopyColFromMat (const CuMatrixBase< Real > &mat, MatrixIndexT col) |
template<typename OtherReal > | |
void | CopyColFromMat (const CuMatrixBase< OtherReal > &mat, MatrixIndexT col) |
void | AddMatVec (const Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType trans, const CuVectorBase< Real > &v, const Real beta) |
void | AddVecVec (Real alpha, const CuVectorBase< Real > &v, const CuVectorBase< Real > &r, Real beta) |
void | AddSpVec (const Real alpha, const CuSpMatrix< Real > &S, const CuVectorBase< Real > &v, const Real beta) |
void | AddDiagMat2 (Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType trans, Real beta) |
Add the diagonal of a matrix times itself: *this = diag(M M^T) + beta * *this (if trans == kNoTrans), or *this = diag(M^T M) + beta * *this (if trans == kTrans). More... | |
void | AddDiagMatMat (Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType transM, const CuMatrixBase< Real > &N, MatrixTransposeType transN, Real beta=1.0) |
Add the diagonal of a matrix product: *this = diag(M N), assuming the "trans" arguments are both kNoTrans; for transpose arguments, it behaves as you would expect. More... | |
CuValue< Real > | operator() (MatrixIndexT i) |
Real | Norm (Real p) |
Real | operator() (MatrixIndexT i) const |
void | CopyDiagFromPacked (const CuPackedMatrix< Real > &M) |
Extracts the diagonal of a packed matrix M; works for Sp or Tp. More... | |
void | CopyDiagFromMat (const CuMatrix< Real > &M) |
Extracts the diagonal of a matrix. More... | |
Real | Max () const |
Returns the maximum value of any element, or -infinity for the empty vector. More... | |
Real | Min () const |
Returns the minimum value of any element, or +infinity for the empty vector. More... | |
void | ReplaceValue (Real orig, Real changed) |
void | MulElements (const CuVectorBase< Real > &v) |
void | DivElements (const CuVectorBase< Real > &v) |
const VectorBase< Real > & | Vec () const |
VectorBase< Real > & | Vec () |
template<> | |
void | CopyColFromMat (const CuMatrixBase< float > &mat, MatrixIndexT col) |
template<> | |
void | CopyColFromMat (const CuMatrixBase< double > &mat, MatrixIndexT col) |
template<> | |
void | CopyFromVec (const CuVectorBase< float > &src) |
template<> | |
void | CopyFromVec (const CuVectorBase< double > &src) |
template<> | |
void | CopyFromVec (const CuVectorBase< float > &src) |
template<> | |
void | CopyFromVec (const CuVectorBase< double > &src) |
Protected Member Functions | |
CuVectorBase () | |
Default constructor: make it protected so the user cannot instantiate this class. More... | |
Protected Attributes | |
Real * | data_ |
GPU data pointer (or regular data pointer if CUDA is not compiled in or we have no GPU). More... | |
MatrixIndexT | dim_ |
dimension of the vector More... | |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (CuVectorBase) | |
Friends | |
class | CuVectorBase< float > |
class | CuVectorBase< double > |
class | CuMatrixBase< Real > |
class | MatrixBase< Real > |
class | CuPackedMatrix< Real > |
class | CuSpMatrix< Real > |
class | CuTpMatrix< Real > |
class | CuRand< Real > |
template<typename OtherReal > | |
OtherReal | VecVec (const CuVectorBase< OtherReal > &v1, const CuVectorBase< OtherReal > &v2) |
void | cu::Splice (const CuMatrixBase< Real > &src, const CuArray< int32 > &frame_offsets, CuMatrixBase< Real > *tgt) |
Vector for CUDA computing.
Definition at line 72 of file matrix-common.h.
|
inlineprotected |
Default constructor: make it protected so the user cannot instantiate this class.
Definition at line 246 of file cu-vector.h.
void Add | ( | Real | value | ) |
Definition at line 1157 of file cu-vector.cc.
Referenced by BlockSoftmax::BackpropagateFnc(), LstmNonlinearityComponent::ConsolidateMemory(), CuVectorBase< float >::Data(), kaldi::MeanVariance(), BatchNormComponent::Propagate(), DropoutMaskComponent::Propagate(), SigmoidComponent::RepairGradients(), TanhComponent::RepairGradients(), RectifiedLinearComponent::RepairGradients(), and Xent::ReportPerClass().
void AddColSumMat | ( | Real | alpha, |
const CuMatrixBase< Real > & | mat, | ||
Real | beta = 1.0 |
||
) |
Sum the columns of the matrix, add to vector.
Definition at line 1298 of file cu-vector.cc.
Referenced by LstmNonlinearityComponent::Backprop(), BlockSoftmax::BackpropagateFnc(), kaldi::CuVectorUnitTestAddColSumMat(), CuVectorBase< float >::Data(), CuMatrixBase< float >::DiffLogSoftmaxPerRow(), KlHmm::PropagateFnc(), MultiBasisComponent::PropagateFnc(), kaldi::TestCuVectorAddColSumMat(), kaldi::UnitTestCuVectorAddColSumMat(), kaldi::UnitTestCuVectorAddColSumMatLarge(), kaldi::nnet1::UnitTestLengthNorm(), AffineTransform::Update(), and ConvolutionalComponent::Update().
void AddDiagMat2 | ( | Real | alpha, |
const CuMatrixBase< Real > & | M, | ||
MatrixTransposeType | trans, | ||
Real | beta | ||
) |
Add the diagonal of a matrix times itself: *this = diag(M M^T) + beta * *this (if trans == kNoTrans), or *this = diag(M^T M) + beta * *this (if trans == kTrans).
Definition at line 595 of file cu-vector.cc.
Referenced by BackpropTruncationComponent::Backprop(), ClipGradientComponent::Backprop(), DiscriminativeComputation::Compute(), kaldi::CuVectorUnitTestAddDiagMat2(), kaldi::cu::DiffNormalizePerRow(), AffineComponentPreconditioned::GetScalingFactor(), OnlinePreconditioner::PreconditionDirections(), OnlinePreconditioner::PreconditionDirectionsInternal(), kaldi::nnet3::PrintParameterStats(), CuVectorBase< float >::Range(), ClipGradientComponent::RepairGradients(), NonlinearComponent::StoreBackpropStats(), kaldi::TestCuVectorAddDiagMat2(), and kaldi::TestCuVectorAddDiagMat2OnVariousShapes().
void AddDiagMatMat | ( | Real | alpha, |
const CuMatrixBase< Real > & | M, | ||
MatrixTransposeType | transM, | ||
const CuMatrixBase< Real > & | N, | ||
MatrixTransposeType | transN, | ||
Real | beta = 1.0 |
||
) |
Add the diagonal of a matrix product: *this = diag(M N), assuming the "trans" arguments are both kNoTrans; for transpose arguments, it behaves as you would expect.
Definition at line 611 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestAddDiagMatMat(), kaldi::cu::DiffNormalizePerRow(), CuMatrixBase< float >::DiffSoftmaxPerRow(), kaldi::nnet3::attention::GetAttentionDotProducts(), kaldi::nnet2::PreconditionDirections(), CuVectorBase< float >::Range(), RestrictedAttentionComponent::StoreStats(), kaldi::TestCuVectorAddDiagMatMat(), kaldi::TestCuVectorAddDiagMatMatShape(), kaldi::nnet3::UnitTestPreconditionDirectionsOnline(), and kaldi::nnet2::UnitTestPreconditionDirectionsOnline().
void AddMatVec | ( | const Real | alpha, |
const CuMatrixBase< Real > & | M, | ||
MatrixTransposeType | trans, | ||
const CuVectorBase< Real > & | v, | ||
const Real | beta | ||
) |
Definition at line 506 of file cu-vector.cc.
Referenced by ModelCollapser::CollapseComponentsAffine(), kaldi::CuVectorUnitTestAddMatVec(), ModelCollapser::PreMultiplyAffineParameters(), CuVectorBase< float >::Range(), kaldi::nnet2::UnitTestGenericComponentInternal(), and kaldi::VecMatVec().
void AddRowSumMat | ( | Real | alpha, |
const CuMatrixBase< Real > & | mat, | ||
Real | beta = 1.0 |
||
) |
Sum the rows of the matrix, add to vector.
Definition at line 1277 of file cu-vector.cc.
Referenced by LstmNonlinearityComponent::ConsolidateMemory(), kaldi::CuVectorUnitTestAddRowSumMat(), CuVectorBase< float >::Data(), Xent::Eval(), SentenceAveragingComponent::PropagateFnc(), RestrictedAttentionComponent::StoreStats(), NonlinearComponent::StoreStatsInternal(), kaldi::TestCuVectorAddRowSumMat(), kaldi::UnitTestCuVectorAddRowSumMat(), kaldi::UnitTestCuVectorAddRowSumMatLarge(), ConvolutionComponent::Update(), SentenceAveragingComponent::Update(), Convolutional1dComponent::Update(), NaturalGradientPerElementScaleComponent::Update(), and NonlinearComponent::UpdateStats().
void AddSpVec | ( | const Real | alpha, |
const CuSpMatrix< Real > & | S, | ||
const CuVectorBase< Real > & | v, | ||
const Real | beta | ||
) |
Definition at line 535 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestAddSpVec(), CuVectorBase< float >::Range(), and kaldi::nnet2::UnitTestPreconditionDirections().
void AddTpVec | ( | const Real | alpha, |
const CuTpMatrix< Real > & | M, | ||
const MatrixTransposeType | trans, | ||
const CuVectorBase< Real > & | v, | ||
const Real | beta | ||
) |
Add triangular matrix times vector: this <– beta*this + alpha*M*v.
Works even if rv == *this.
Definition at line 698 of file cu-vector.cc.
Referenced by CuVectorBase< float >::Data(), kaldi::UnitTestCuVectorAddTp(), and kaldi::UnitTestCuVectorAddTpVec().
void AddVec | ( | Real | alpha, |
const CuVectorBase< Real > & | vec, | ||
Real | beta = 1.0 |
||
) |
Definition at line 1237 of file cu-vector.cc.
Referenced by BatchNormComponent::Add(), CuVectorBase< float >::ApproxEqual(), LstmNonlinearityComponent::Backprop(), LstmNonlinearityComponent::ConsolidateMemory(), kaldi::CuVectorUnitTestAddDiagMatMat(), kaldi::CuVectorUnitTestAddVec(), kaldi::CuVectorUnitTestAddVecCross(), CuVectorBase< float >::Data(), SigmoidComponent::RepairGradients(), TanhComponent::RepairGradients(), RectifiedLinearComponent::RepairGradients(), Xent::ReportPerClass(), BatchNormComponent::StoreStats(), kaldi::UnitTestCuMatrixAddDiagVecMat(), and kaldi::UnitTestCuVectorAddVec().
void AddVec | ( | Real | alpha, |
const CuVectorBase< OtherReal > & | vec, | ||
Real | beta = 1.0 |
||
) |
Definition at line 1261 of file cu-vector.cc.
void AddVecVec | ( | Real | alpha, |
const CuVectorBase< Real > & | v, | ||
const CuVectorBase< Real > & | r, | ||
Real | beta | ||
) |
Definition at line 560 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestAddVecVec(), BatchNormComponent::Propagate(), CuVectorBase< float >::Range(), BatchNormComponent::Read(), and BatchNormComponent::Write().
|
inline |
Definition at line 143 of file cu-vector.h.
Referenced by kaldi::CuVectorUnitTestApplyCeiling(), kaldi::CuVectorUnitTestApplyCeilingNoCount(), kaldi::TestCuVectorApplyCeiling(), and kaldi::TestCuVectorApplyCeilingNoCount().
void ApplyExp | ( | ) |
Definition at line 442 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyPow(), StatisticsPoolingComponent::Backprop(), and kaldi::CuVectorUnitTestApplyExp().
|
inline |
Definition at line 139 of file cu-vector.h.
Referenced by kaldi::CuVectorUnitTestApplyFloor(), kaldi::CuVectorUnitTestApplyFloorNoCount(), kaldi::cu::DiffNormalizePerRow(), BatchNormComponent::Propagate(), SingleUtteranceNnet2DecoderThreaded::RunNnetEvaluationInternal(), kaldi::TestCuVectorApplyFloor(), kaldi::TestCuVectorApplyFloorNoCount(), AffineTransform::Update(), and ConvolutionalComponent::Update().
void ApplyLog | ( | ) |
Definition at line 462 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyPow(), and kaldi::CuVectorUnitTestApplyLog().
void ApplyLogSoftMax | ( | ) |
Definition at line 484 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyPow().
|
inline |
Definition at line 147 of file cu-vector.h.
Referenced by kaldi::CuVectorUnitTestApplyPow(), AffineComponentPreconditionedOnline::GetScalingFactor(), kaldi::MeanVariance(), BatchNormComponent::Propagate(), RectifiedLinearComponent::RepairGradients(), Xent::ReportPerClass(), kaldi::nnet1::UnitTestLengthNorm(), and AffineTransform::Update().
void ApplySoftMax | ( | ) |
Definition at line 334 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyPow(), kaldi::CuVectorUnitTestApplySoftMax(), and kaldi::TestCuVectorSoftmax().
bool ApproxEqual | ( | const CuVectorBase< Real > & | other, |
float | tol = 0.01 |
||
) | const |
Definition at line 583 of file cu-vector.cc.
Referenced by CuVectorBase< float >::Data(), and kaldi::nnet2::UnitTestPreconditionDirections().
void Ceiling | ( | const CuVectorBase< Real > & | src, |
Real | ceiling_val, | ||
MatrixIndexT * | ceiled_count = NULL |
||
) |
Definition at line 385 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyCeiling(), and CuVectorBase< float >::Data().
void CopyColFromMat | ( | const CuMatrixBase< float > & | mat, |
MatrixIndexT | col | ||
) |
Definition at line 122 of file cu-vector.cc.
void CopyColFromMat | ( | const CuMatrixBase< double > & | mat, |
MatrixIndexT | col | ||
) |
Definition at line 144 of file cu-vector.cc.
void CopyColFromMat | ( | const CuMatrixBase< Real > & | mat, |
MatrixIndexT | col | ||
) |
Definition at line 103 of file cu-vector.cc.
Referenced by StatisticsPoolingComponent::Backprop(), kaldi::CuVectorUnitTestCopyFromMat(), CuVectorBase< float >::Range(), kaldi::UnitTestCuMatrixAddDiagVecMat(), NaturalGradientAffineComponent::Update(), AffineComponentPreconditioned::Update(), AffineComponentPreconditionedOnline::Update(), BlockAffineComponentPreconditioned::Update(), and TdnnComponent::UpdateNaturalGradient().
void CopyColFromMat | ( | const CuMatrixBase< OtherReal > & | mat, |
MatrixIndexT | col | ||
) |
void CopyDiagFromMat | ( | const CuMatrix< Real > & | M | ) |
Extracts the diagonal of a matrix.
Definition at line 1198 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestAddDiagMatMat(), kaldi::CuVectorUnitTestCopyDiagFromMat(), and CuVectorBase< float >::operator()().
void CopyDiagFromPacked | ( | const CuPackedMatrix< Real > & | M | ) |
Extracts the diagonal of a packed matrix M; works for Sp or Tp.
Definition at line 1177 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestCopyDiagFromPacked(), CuVectorBase< float >::operator()(), CuPackedMatrix< Real >::Trace(), and kaldi::TraceSpSp().
void CopyElements | ( | const CuMatrixBase< Real > & | mat, |
const MatrixTransposeType | trans, | ||
const CuArrayBase< int32 > & | elements | ||
) |
Copies selected elements from 'mat' to *this.
Expects this->Dim() to equal elements.Dim(). If trans == kNoTrans, expects mat.NumRows() to equal this.Dim(), and for each i, copies mat(i, elements[i]) to (*this)(i). If trans == kTrans, expects mat.NumCols() to equal this.Dim(), and for each i, copies mat(elements[i], i) to (*this)(i).
Definition at line 1340 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestCopyElements(), and CuVectorBase< float >::Data().
void CopyFromVec | ( | const CuVectorBase< Real > & | src | ) |
Copy functions; these will crash if the dimension do not match.
The operator = in class CuVector will also change the sizes for you.
Definition at line 1078 of file cu-vector.cc.
Referenced by BlockAffineComponent::BlockAffineComponent(), CuSparseMatrix< Real >::CopyElementsToVec(), CuSparseMatrix< Real >::CopyFromSmat(), CuVectorBase< float >::CopyFromVec(), CuMatrixBase< float >::CopyRangeFromMatClamped(), CuSparseMatrix< Real >::CuSparseMatrix(), CuVector< float >::CuVector(), kaldi::CuVectorUnitTestCopyCross(), kaldi::CuVectorUnitTestCopyCross2(), CuVectorBase< float >::Data(), SoftmaxComponent::MixUp(), CuVector< float >::operator=(), OnlinePreconditionerSimple::PreconditionDirections(), OnlineNaturalGradientSimple::PreconditionDirections(), BatchNormComponent::Propagate(), CuRand< float >::RandGaussian(), kaldi::nnet1::RandUniform(), DctComponent::Reorder(), RectifiedLinearComponent::RepairGradients(), NnetBatchComputer::SplitUtteranceIntoTasks(), kaldi::TestCuVectorCopyFromVec(), kaldi::UnitTestCuMatrixAddDiagVecMat(), kaldi::UnitTestCuMatrixAddVecToCols(), kaldi::UnitTestCuMatrixAddVecToRows(), kaldi::UnitTestCuMatrixAddVecVec(), kaldi::UnitTestCuMatrixDivRowsVec(), kaldi::UnitTestCuMatrixMulColsVec(), kaldi::UnitTestCuMatrixMulRowsVec(), kaldi::UnitTestCuVectorAddColSumMat(), kaldi::UnitTestCuVectorAddColSumMatLarge(), kaldi::UnitTestCuVectorAddRowSumMat(), kaldi::UnitTestCuVectorAddRowSumMatLarge(), kaldi::UnitTestCuVectorAddTpVec(), kaldi::UnitTestCuVectorAddVec(), kaldi::UnitTestCuVectorCopyFromVec(), kaldi::UnitTestCuVectorInvertElements(), and kaldi::UnitTestCuVectorMulTp().
void CopyFromVec | ( | const CuVectorBase< OtherReal > & | M | ) |
Definition at line 377 of file cu-vector.h.
void CopyFromVec | ( | const VectorBase< OtherReal > & | src | ) |
Definition at line 904 of file cu-vector.cc.
void CopyFromVec< float > | ( | const CuVectorBase< float > & | src | ) |
void CopyFromVec< double > | ( | const CuVectorBase< double > & | src | ) |
void CopyFromVec | ( | const CuVectorBase< float > & | src | ) |
Definition at line 869 of file cu-vector.cc.
void CopyFromVec | ( | const CuVectorBase< double > & | src | ) |
Definition at line 886 of file cu-vector.cc.
void CopyRowsFromMat | ( | const CuMatrixBase< Real > & | M | ) |
Definition at line 164 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestCopyFromMat(), and CuVectorBase< float >::Data().
void CopyRowsFromMat | ( | const MatrixBase< Real > & | M | ) |
Definition at line 218 of file cu-vector.cc.
template void CopyToVec | ( | VectorBase< OtherReal > * | dst | ) | const |
Definition at line 938 of file cu-vector.cc.
Referenced by CuSparseMatrix< Real >::CopyToSmat(), CuVectorBase< float >::CopyToVec(), kaldi::nnet1::CountCorrectFramesWeighted(), CuVectorBase< float >::Data(), kaldi::nnet1::MomentStatistics(), kaldi::UnitTestCuDiffXent(), kaldi::UnitTestCuVectorAddColSumMat(), kaldi::UnitTestCuVectorAddColSumMatLarge(), kaldi::UnitTestCuVectorAddRowSumMat(), kaldi::UnitTestCuVectorAddRowSumMatLarge(), kaldi::UnitTestCuVectorAddTpVec(), kaldi::UnitTestCuVectorAddVec(), kaldi::UnitTestCuVectorInvertElements(), kaldi::UnitTestCuVectorMulTp(), kaldi::UnitTestMulTp(), and kaldi::UnitTestVector().
|
inline |
Returns a pointer to the start of the vector's data.
Definition at line 72 of file cu-vector.h.
Referenced by CuMatrixBase< float >::AddDiagVecMat(), CuMatrixBase< float >::AddMatDiagVec(), CuVectorBase< float >::AddMatVec(), CuVectorBase< float >::AddSpVec(), CuSpMatrix< Real >::AddVec2(), CuVectorBase< float >::AddVecVec(), CuMatrixBase< float >::AddVecVec(), CuVectorBase< float >::ApplyLog(), StatisticsPoolingComponent::Backprop(), kaldi::cu::BackpropLstmNonlinearity(), CuVectorBase< float >::Ceiling(), CuMatrix< float >::CompObjfAndDeriv(), CuMatrixBase< float >::CopyColFromVec(), CuMatrixBase< float >::CopyColsFromVec(), CuVectorBase< float >::CopyFromVec(), MatrixBase< float >::CopyRowsFromVec(), CuMatrixBase< float >::CopyRowsFromVec(), CuVectorBase< float >::DivElements(), kaldi::cu::EnsureNonzero(), CuVectorBase< float >::Floor(), NnetBatchComputer::FormatInputs(), CuVectorBase< float >::Max(), CuMatrixBase< float >::Max(), CuVectorBase< float >::Min(), CuMatrixBase< float >::Min(), CuVectorBase< float >::MulElements(), CuVectorBase< float >::Pow(), CuRand< float >::RandGaussian(), CuRand< float >::RandUniform(), NnetBatchComputer::SplitUtteranceIntoTasks(), RestrictedAttentionComponent::StoreStats(), CuVectorBase< float >::Sum(), CuMatrixBase< float >::Sum(), kaldi::TestCuVectorCopyFromVec(), CuMatrixBase< float >::Trace(), kaldi::TraceMatMat(), and kaldi::VecVec().
|
inline |
Returns a pointer to the start of the vector's data (const).
Definition at line 74 of file cu-vector.h.
|
inline |
Dimensions.
Definition at line 69 of file cu-vector.h.
Referenced by DiscriminativeObjectiveInfo::AccumulateGradients(), DiscriminativeObjectiveInfo::AccumulateOutput(), NonlinearComponent::Add(), CuMatrixBase< float >::AddDiagVecMat(), CuMatrixBase< float >::AddMatDiagVec(), NnetStats::AddStatsFromNnet(), CuVectorBase< float >::AddVec(), CuSpMatrix< Real >::AddVec2(), CuMatrixBase< float >::AddVecToCols(), CuMatrixBase< float >::AddVecToRows(), CuMatrixBase< float >::AddVecVec(), AffineComponent::AffineComponent(), kaldi::cu::BackpropLstmNonlinearity(), Convolutional1dComponent::Convolutional1dComponent(), ConvolutionComponent::ConvolutionComponent(), CuMatrixBase< float >::CopyColFromVec(), CuMatrixBase< float >::CopyColsFromVec(), CuSparseMatrix< Real >::CopyElementsToVec(), CuVectorBase< float >::CopyFromVec(), MatrixBase< float >::CopyRowsFromVec(), CuMatrixBase< float >::CopyRowsFromVec(), kaldi::nnet1::CountCorrectFramesWeighted(), kaldi::CuRandGaussianVectorSpeedTest(), kaldi::CuRandUniformVectorSpeedTest(), CuVector< float >::CuVector(), CuMatrixBase< float >::DivRowsVec(), kaldi::cu::EnsureNonzero(), Xent::Eval(), ModelCollapser::GetDiagonallyPreModifiedComponentIndex(), AffineComponentPreconditionedOnline::GetScalingFactor(), FixedScaleComponent::Init(), FixedBiasComponent::Init(), PerElementScaleComponent::Init(), kaldi::MeanVariance(), SoftmaxComponent::MixUp(), kaldi::nnet1::MomentStatistics(), CuMatrixBase< float >::MulColsVec(), CuMatrixBase< float >::MulRowsVec(), NaturalGradientAffineComponent::NaturalGradientAffineComponent(), CuVector< float >::operator=(), CuMatrixBase< float >::ParametricRelu(), ModelCollapser::PreMultiplyAffineParameters(), kaldi::nnet3::PrintParameterStats(), CuRand< float >::RandGaussian(), CuRand< float >::RandUniform(), kaldi::nnet1::RandUniform(), AffineTransform::SetBias(), NnetBatchComputer::SplitUtteranceIntoTasks(), BatchNormComponent::StoreStats(), kaldi::TestCuVectorCopyFromVec(), kaldi::VecMatVec(), and kaldi::VecVec().
void DivElements | ( | const CuVectorBase< Real > & | v | ) |
Definition at line 857 of file cu-vector.cc.
Referenced by CuVectorBase< float >::operator()().
void Floor | ( | const CuVectorBase< Real > & | src, |
Real | floor_val, | ||
MatrixIndexT * | floored_count = NULL |
||
) |
Definition at line 353 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyFloor(), and CuVectorBase< float >::Data().
void InvertElements | ( | ) |
Definition at line 1318 of file cu-vector.cc.
Referenced by ScaleAndOffsetComponent::BackpropInternal(), kaldi::CuVectorUnitTestInvertElements(), CuVectorBase< float >::Data(), kaldi::UnitTestCuVectorInvertElements(), AffineTransform::Update(), and ConvolutionalComponent::Update().
|
private |
Real Max | ( | ) | const |
Returns the maximum value of any element, or -infinity for the empty vector.
Definition at line 782 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestMax(), ModelCollapser::GetDiagonallyPreModifiedComponentIndex(), CuMatrixBase< float >::Max(), and CuVectorBase< float >::operator()().
Real Min | ( | ) | const |
Returns the minimum value of any element, or +infinity for the empty vector.
Definition at line 744 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestMin(), ModelCollapser::GetDiagonallyPreModifiedComponentIndex(), CuMatrixBase< float >::Min(), and CuVectorBase< float >::operator()().
void MulElements | ( | const CuVectorBase< Real > & | v | ) |
Definition at line 838 of file cu-vector.cc.
Referenced by BackpropTruncationComponent::Backprop(), kaldi::CuVectorUnitTestInvertElements(), AffineComponentPreconditionedOnline::GetScalingFactor(), CuVectorBase< float >::operator()(), Xent::ReportPerClass(), and kaldi::UnitTestVector().
void MulTp | ( | const CuTpMatrix< Real > & | M, |
const MatrixTransposeType | trans | ||
) |
Multiplies this vector by lower-triangular marix: *this <– *this *M.
Definition at line 727 of file cu-vector.cc.
Referenced by CuVectorBase< float >::AddTpVec(), CuVectorBase< float >::Data(), kaldi::UnitTestCuVectorMulTp(), and kaldi::UnitTestMulTp().
Real Norm | ( | Real | p | ) |
Definition at line 193 of file cu-vector.cc.
Referenced by kaldi::CuVectorUnitTestNorm(), CuSparseMatrix< Real >::FrobeniusNorm(), and CuVectorBase< float >::operator()().
|
inline |
Definition at line 196 of file cu-vector.h.
|
inline |
Definition at line 204 of file cu-vector.h.
void Pow | ( | const CuVectorBase< Real > & | src, |
Real | power | ||
) |
Definition at line 419 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyPow(), and CuVectorBase< float >::Data().
|
inline |
Definition at line 160 of file cu-vector.h.
Referenced by ModelCollapser::CollapseComponentsAffine(), CuRand< float >::RandGaussian(), and kaldi::UnitTestCuSubVector().
|
inline |
Definition at line 164 of file cu-vector.h.
void ReplaceValue | ( | Real | orig, |
Real | changed | ||
) |
Definition at line 820 of file cu-vector.cc.
Referenced by CuVectorBase< float >::operator()(), and kaldi::UnitTestCuVectorReplaceValue().
void Scale | ( | Real | value | ) |
Definition at line 1216 of file cu-vector.cc.
Referenced by BlockSoftmax::BackpropagateFnc(), kaldi::CuVectorUnitTestAddDiagMatMat(), kaldi::CuVectorUnitTestScale(), CuVectorBase< float >::Data(), kaldi::nnet2::PreconditionDirections(), DropoutMaskComponent::Propagate(), BatchNormComponent::Read(), RectifiedLinearComponent::RepairGradients(), Xent::ReportPerClass(), BatchNormComponent::Scale(), kaldi::UnitTestCuMatrixAddDiagVecMat(), kaldi::UnitTestVector(), AffineTransform::Update(), ConvolutionalComponent::Update(), and BatchNormComponent::Write().
void Set | ( | Real | value | ) |
Definition at line 1135 of file cu-vector.cc.
Referenced by CuSparseMatrix< Real >::CuSparseMatrix(), kaldi::CuVectorUnitTestSum(), CuVectorBase< float >::Data(), FixedScaleComponent::InitFromConfig(), StatisticsPoolingComponent::Propagate(), CuSparseMatrix< Real >::Resize(), kaldi::TestCuVectorVecVecOne(), kaldi::nnet1::UnitTestLengthNorm(), and kaldi::nnet1::UnitTestSimpleSentenceAveragingComponent().
void SetRandn | ( | ) |
Definition at line 281 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyPow(), LstmNonlinearityComponent::ConsolidateMemory(), kaldi::CuVectorUnitTestAddDiagMat2(), kaldi::CuVectorUnitTestAddDiagMatMat(), kaldi::CuVectorUnitTestAddMatVec(), kaldi::CuVectorUnitTestAddSpVec(), kaldi::CuVectorUnitTestAddVec(), kaldi::CuVectorUnitTestAddVecCross(), kaldi::CuVectorUnitTestAddVecExtra(), kaldi::CuVectorUnitTestAddVecVec(), kaldi::CuVectorUnitTestApplyCeiling(), kaldi::CuVectorUnitTestApplyCeilingNoCount(), kaldi::CuVectorUnitTestApplyExp(), kaldi::CuVectorUnitTestApplyFloor(), kaldi::CuVectorUnitTestApplyFloorNoCount(), kaldi::CuVectorUnitTestApplyLog(), kaldi::CuVectorUnitTestApplyPow(), kaldi::CuVectorUnitTestApplySoftMax(), kaldi::CuVectorUnitTestApproxEqual(), kaldi::CuVectorUnitTestCopyCross(), kaldi::CuVectorUnitTestCopyCross2(), kaldi::CuVectorUnitTestCopyElements(), kaldi::CuVectorUnitTestInvertElements(), kaldi::CuVectorUnitTestMax(), kaldi::CuVectorUnitTestMin(), kaldi::CuVectorUnitTestScale(), kaldi::CuVectorUnitTestVecVec(), FixedScaleComponent::InitFromConfig(), FixedBiasComponent::InitFromConfig(), ConvolutionComponent::PerturbParams(), TimeHeightConvolutionComponent::PerturbParams(), TdnnComponent::PerturbParams(), RepeatedAffineComponent::PerturbParams(), ConstantComponent::PerturbParams(), AffineComponent::PerturbParams(), BlockAffineComponent::PerturbParams(), PerElementScaleComponent::PerturbParams(), PerElementOffsetComponent::PerturbParams(), ConstantFunctionComponent::PerturbParams(), Convolutional1dComponent::PerturbParams(), ScaleAndOffsetComponent::PerturbParams(), kaldi::TestCuMatrixAddDiagVecMat(), kaldi::TestCuMatrixDivRowsVec(), kaldi::TestCuVectorAddColSumMat(), kaldi::TestCuVectorAddDiagMat2(), kaldi::TestCuVectorAddDiagMat2OnVariousShapes(), kaldi::TestCuVectorAddDiagMatMat(), kaldi::TestCuVectorAddDiagMatMatShape(), kaldi::TestCuVectorAddRowSumMat(), kaldi::TestCuVectorApplyCeiling(), kaldi::TestCuVectorApplyCeilingNoCount(), kaldi::TestCuVectorApplyFloor(), kaldi::TestCuVectorApplyFloorNoCount(), kaldi::TestCuVectorCopyFromVec(), kaldi::TestCuVectorSoftmax(), kaldi::TestCuVectorSum(), kaldi::TestCuVectorVecVecOne(), kaldi::UnitTestBackpropLstmNonlinearity(), kaldi::UnitTestCuMatrixAddDiagVecMat(), kaldi::UnitTestCuMatrixAddMatDiagVec(), kaldi::UnitTestCuMatrixCopyColsFromVec(), kaldi::UnitTestCuMatrixCopyRowsFromVec(), kaldi::UnitTestCuSubVector(), kaldi::UnitTestCuVectorIO(), kaldi::nnet2::UnitTestFixedBiasComponent(), kaldi::nnet2::UnitTestFixedScaleComponent(), kaldi::nnet2::UnitTestGenericComponentInternal(), kaldi::UnitTestVecMatVec(), and kaldi::UnitTestVector().
void SetRandUniform | ( | ) |
void SetZero | ( | ) |
Math operations.
Definition at line 1098 of file cu-vector.cc.
Referenced by StatisticsPoolingComponent::Backprop(), CuVectorBase< float >::Data(), DiscriminativeObjectiveInfo::Reset(), BatchNormComponent::Scale(), and BatchNormComponent::ZeroStats().
Real Sum | ( | ) | const |
Definition at line 297 of file cu-vector.cc.
Referenced by CuVectorBase< float >::ApplyPow(), CuVectorBase< float >::Ceiling(), LstmNonlinearityComponent::ConsolidateMemory(), kaldi::CuVectorUnitTestCopyDiagFromMat(), Xent::Eval(), CuVectorBase< float >::Floor(), AffineComponentPreconditionedOnline::GetScalingFactor(), kaldi::MeanVariance(), SoftmaxComponent::MixUp(), OnlinePreconditioner::PreconditionDirectionsInternal(), kaldi::nnet3::PrintParameterStats(), SigmoidComponent::RepairGradients(), TanhComponent::RepairGradients(), RectifiedLinearComponent::RepairGradients(), Xent::Report(), CuSparseMatrix< Real >::Sum(), CuMatrixBase< float >::Sum(), kaldi::TestCuVectorSum(), CuPackedMatrix< Real >::Trace(), and kaldi::UnitTestCuMatrixAddDiagVecMat().
|
inline |
Definition at line 235 of file cu-vector.h.
Referenced by CuMatrixBase< float >::AddDiagVecMat(), CuMatrixBase< float >::AddMatDiagVec(), CuVectorBase< float >::AddMatVec(), CuVectorBase< float >::AddSpVec(), CuVectorBase< float >::AddTpVec(), CuVectorBase< float >::AddVec(), CuSpMatrix< Real >::AddVec2(), CuMatrixBase< float >::AddVecToCols(), CuMatrixBase< float >::AddVecToRows(), CuVectorBase< float >::AddVecVec(), CuMatrixBase< float >::AddVecVec(), kaldi::cu::BackpropLstmNonlinearity(), CuVectorBase< float >::Ceiling(), CuMatrixBase< float >::CopyColFromVec(), CuMatrixBase< float >::CopyColsFromVec(), CuSparseMatrix< Real >::CopyElementsToVec(), CuVectorBase< float >::CopyFromVec(), MatrixBase< float >::CopyRowsFromVec(), CuMatrixBase< float >::CopyRowsFromVec(), CuSparseMatrix< Real >::CuSparseMatrix(), CuMatrixBase< float >::DiffParametricRelu(), CuMatrixBase< float >::DiffXent(), CuMatrixBase< float >::DivRowsVec(), CuVectorBase< float >::Floor(), CuMatrixBase< float >::MulColsVec(), CuVectorBase< float >::MulElements(), CuMatrixBase< float >::MulRowsVec(), CuMatrixBase< float >::ParametricRelu(), CuVectorBase< float >::Pow(), CuRand< float >::RandGaussian(), CuRand< float >::RandUniform(), and kaldi::VecVec().
|
inline |
Definition at line 238 of file cu-vector.h.
|
friend |
|
friend |
Definition at line 54 of file cu-vector.h.
|
friend |
Definition at line 56 of file cu-vector.h.
|
friend |
Definition at line 66 of file cu-vector.h.
|
friend |
Definition at line 57 of file cu-vector.h.
|
friend |
Definition at line 58 of file cu-vector.h.
|
friend |
Definition at line 53 of file cu-vector.h.
|
friend |
Definition at line 52 of file cu-vector.h.
|
friend |
Definition at line 55 of file cu-vector.h.
|
friend |
|
protected |
GPU data pointer (or regular data pointer if CUDA is not compiled in or we have no GPU).
Definition at line 248 of file cu-vector.h.
Referenced by CuVectorBase< float >::AddVec(), CuMatrixBase< float >::AddVecToCols(), CuMatrixBase< float >::AddVecToRows(), CuVectorBase< float >::CopyFromVec(), CuSubVector< Real >::CuSubVector(), CuVectorBase< float >::Data(), CuMatrixBase< float >::DiffParametricRelu(), CuMatrixBase< float >::DiffXent(), CuMatrixBase< float >::DivRowsVec(), CuMatrixBase< float >::MulColsVec(), CuMatrixBase< float >::MulRowsVec(), CuVectorBase< float >::operator()(), CuMatrixBase< float >::ParametricRelu(), and CuVector< float >::Swap().
|
protected |
dimension of the vector
Definition at line 250 of file cu-vector.h.
Referenced by CuVectorBase< float >::AddMatVec(), CuVectorBase< float >::AddSpVec(), CuVectorBase< float >::AddTpVec(), CuVectorBase< float >::AddVecVec(), CuVectorBase< float >::ApproxEqual(), CuVectorBase< float >::CopyFromVec(), CuSubVector< Real >::CuSubVector(), CuVectorBase< float >::Dim(), CuVectorBase< float >::DivElements(), CuVectorBase< float >::MulElements(), CuVectorBase< float >::operator()(), and CuVector< float >::Swap().