24 #ifndef KALDI_NNET2_NNET_COMPONENT_H_ 25 #define KALDI_NNET2_NNET_COMPONENT_H_ 86 const std::vector<int32> offsets)
161 virtual std::string Type()
const = 0;
173 virtual void InitFromString(std::string args) = 0;
176 virtual int32 InputDim()
const = 0;
179 virtual int32 OutputDim()
const = 0;
188 virtual std::vector<int32>
Context()
const {
return std::vector<int32>(1, 0); }
197 virtual void Propagate(
const ChunkInfo &in_info,
213 Propagate(in_info, out_info, in,
227 virtual void Backprop(
const ChunkInfo &in_info,
241 static Component* ReadNew(std::istream &is,
bool binary);
250 static Component *NewFromString(
const std::string &initializer_line);
254 static Component *NewComponentOfType(
const std::string &type);
256 virtual void Read(std::istream &is,
bool binary) = 0;
260 virtual void Write(std::ostream &os,
bool binary)
const = 0;
262 virtual std::string Info()
const;
282 learning_rate_(other.learning_rate_){ }
285 learning_rate_ = learning_rate;
295 virtual void SetZero(
bool treat_as_gradient) = 0;
325 virtual std::string Info()
const;
363 virtual void InitFromString(std::string args);
366 virtual void Read(std::istream &is,
bool binary);
369 virtual void Write(std::ostream &os,
bool binary)
const;
379 double Count()
const {
return count_; }
382 void SetDim(
int32 dim);
385 friend class NormalizationComponent;
415 Init(input_dim, output_dim);
418 virtual std::string
Type()
const {
return "MaxoutComponent"; }
419 virtual void InitFromString(std::string args);
423 virtual void Propagate(
const ChunkInfo &in_info,
427 virtual void Backprop(
const ChunkInfo &in_info,
439 virtual void Read(std::istream &is,
bool binary);
443 virtual void Write(std::ostream &os,
bool binary)
const;
445 virtual std::string Info()
const;
474 Init(input_dim, output_dim, pool_size, pool_stride);
477 pool_size_(0), pool_stride_(0) { }
478 virtual std::string
Type()
const {
return "MaxpoolingComponent"; }
479 virtual void InitFromString(std::string args);
483 virtual void Propagate(
const ChunkInfo &in_info,
487 virtual void Backprop(
const ChunkInfo &in_info,
498 pool_size_, pool_stride_); }
500 virtual void Read(std::istream &is,
bool binary);
504 virtual void Write(std::ostream &os,
bool binary)
const;
506 virtual std::string Info()
const;
518 Init(input_dim, output_dim, p);
521 virtual std::string
Type()
const {
return "PnormComponent"; }
522 virtual void InitFromString(std::string args);
526 virtual void Propagate(
const ChunkInfo &in_info,
530 virtual void Backprop(
const ChunkInfo &in_info,
542 virtual void Read(std::istream &is,
bool binary);
546 virtual void Write(std::ostream &os,
bool binary)
const;
548 virtual std::string Info()
const;
560 virtual std::string
Type()
const {
return "NormalizeComponent"; }
565 virtual void Propagate(
const ChunkInfo &in_info,
569 virtual void Backprop(
const ChunkInfo &in_info,
590 virtual std::string
Type()
const {
return "SigmoidComponent"; }
595 virtual void Propagate(
const ChunkInfo &in_info,
599 virtual void Backprop(
const ChunkInfo &in_info,
615 virtual std::string
Type()
const {
return "TanhComponent"; }
620 virtual void Propagate(
const ChunkInfo &in_info,
624 virtual void Backprop(
const ChunkInfo &in_info,
644 virtual std::string
Type()
const {
return "PowerComponent"; }
645 virtual void InitFromString(std::string args);
649 virtual void Propagate(
const ChunkInfo &in_info,
653 virtual void Backprop(
const ChunkInfo &in_info,
663 virtual void Read(std::istream &is,
bool binary);
667 virtual void Write(std::ostream &os,
bool binary)
const;
669 virtual std::string Info()
const;
681 virtual std::string
Type()
const {
return "RectifiedLinearComponent"; }
686 virtual void Propagate(
const ChunkInfo &in_info,
690 virtual void Backprop(
const ChunkInfo &in_info,
706 virtual std::string
Type()
const {
return "SoftHingeComponent"; }
711 virtual void Propagate(
const ChunkInfo &in_info,
715 virtual void Backprop(
const ChunkInfo &in_info,
734 dim_(other.dim_), scale_(other.scale_) { }
736 virtual std::string
Type()
const {
return "ScaleComponent"; }
741 virtual void Propagate(
const ChunkInfo &in_info,
745 virtual void Backprop(
const ChunkInfo &in_info,
755 virtual void Read(std::istream &is,
bool binary);
757 virtual void Write(std::ostream &os,
bool binary)
const;
761 virtual void InitFromString(std::string args);
763 virtual std::string Info()
const;
782 virtual std::string
Type()
const {
return "SoftmaxComponent"; }
786 virtual void Propagate(
const ChunkInfo &in_info,
790 virtual void Backprop(
const ChunkInfo &in_info,
798 void MixUp(
int32 num_mixtures,
815 virtual std::string
Type()
const {
return "LogSoftmaxComponent"; }
819 virtual void Propagate(
const ChunkInfo &in_info,
823 virtual void Backprop(
const ChunkInfo &in_info,
858 std::string matrix_filename);
862 virtual void Resize(
int32 input_dim,
int32 output_dim);
873 virtual std::string Info()
const;
874 virtual void InitFromString(std::string args);
877 virtual std::string
Type()
const {
return "AffineComponent"; }
881 virtual void Propagate(
const ChunkInfo &in_info,
887 virtual void Backprop(
const ChunkInfo &in_info,
894 virtual void SetZero(
bool treat_as_gradient);
895 virtual void Read(std::istream &is,
bool binary);
896 virtual void Write(std::ostream &os,
bool binary)
const;
906 virtual int32 GetParameterDim()
const;
912 virtual void LimitRank(
int32 dimension,
916 void Widen(
int32 new_dimension,
919 std::vector<NonlinearComponent*> c2,
928 UpdateSimple(in_value, out_deriv);
932 virtual void UpdateSimple(
950 virtual std::string
Type()
const {
return "AffineComponentPreconditioned"; }
952 virtual void Read(std::istream &is,
bool binary);
953 virtual void Write(std::ostream &os,
bool binary)
const;
959 BaseFloat max_change, std::string matrix_filename);
961 virtual void InitFromString(std::string args);
962 virtual std::string Info()
const;
999 virtual std::string
Type()
const {
1000 return "AffineComponentPreconditionedOnline";
1003 virtual void Read(std::istream &is,
bool binary);
1004 virtual void Write(std::ostream &os,
bool binary)
const;
1015 std::string matrix_filename);
1017 virtual void Resize(
int32 input_dim,
int32 output_dim);
1024 int32 update_period,
1027 virtual void InitFromString(std::string args);
1028 virtual std::string Info()
const;
1073 void SetPreconditionerConfigs();
1075 virtual void Update(
1098 void Init(
int32 input_dim,
1099 std::vector<int32> context,
1100 int32 const_component_dim=0);
1101 virtual std::string
Type()
const {
return "SpliceComponent"; }
1102 virtual std::string Info()
const;
1103 virtual void InitFromString(std::string args);
1105 virtual int32 OutputDim()
const;
1106 virtual std::vector<int32>
Context()
const {
return context_; }
1108 virtual void Propagate(
const ChunkInfo &in_info,
1112 virtual void Backprop(
const ChunkInfo &in_info,
1122 virtual void Read(std::istream &is,
bool binary);
1123 virtual void Write(std::ostream &os,
bool binary)
const;
1136 void Init(
int32 dim,
1137 std::vector<int32> context);
1138 virtual std::string
Type()
const {
return "SpliceMaxComponent"; }
1139 virtual std::string Info()
const;
1140 virtual void InitFromString(std::string args);
1143 virtual std::vector<int32>
Context()
const {
return context_; }
1145 virtual void Propagate(
const ChunkInfo &in_info,
1149 virtual void Backprop(
const ChunkInfo &in_info,
1159 virtual void Read(std::istream &is,
bool binary);
1160 virtual void Write(std::ostream &os,
bool binary)
const;
1173 virtual int32 InputDim()
const {
return linear_params_.NumCols() * num_blocks_; }
1175 virtual int32 GetParameterDim()
const;
1184 virtual void InitFromString(std::string args);
1187 virtual std::string
Type()
const {
return "BlockAffineComponent"; }
1191 virtual void Propagate(
const ChunkInfo &in_info,
1195 virtual void Backprop(
const ChunkInfo &in_info,
1202 virtual void SetZero(
bool treat_as_gradient);
1203 virtual void Read(std::istream &is,
bool binary);
1204 virtual void Write(std::ostream &os,
bool binary)
const;
1214 UpdateSimple(in_value, out_deriv);
1218 virtual void UpdateSimple(
1250 virtual void InitFromString(std::string args);
1253 virtual std::string
Type()
const {
return "BlockAffineComponentPreconditioned"; }
1254 virtual void SetZero(
bool treat_as_gradient);
1255 virtual void Read(std::istream &is,
bool binary);
1256 virtual void Write(std::ostream &os,
bool binary)
const;
1260 virtual void Update(
1278 void Init(
const std::vector<int32> &sizes);
1280 void GetSizes(std::vector<int32> *sizes)
const;
1283 virtual void InitFromString(std::string args);
1285 virtual std::string
Type()
const {
return "SumGroupComponent"; }
1289 virtual void Propagate(
const ChunkInfo &in_info,
1294 virtual void Backprop(
const ChunkInfo &in_info,
1302 virtual void Read(std::istream &is,
bool binary);
1303 virtual void Write(std::ostream &os,
bool binary)
const;
1322 void Init(
int32 dim);
1323 void Init(
const std::vector<int32> &reorder);
1333 virtual void InitFromString(std::string args);
1334 virtual void Read(std::istream &is,
bool binary);
1335 virtual void Write(std::ostream &os,
bool binary)
const;
1336 virtual std::string
Type()
const {
return "PermuteComponent"; }
1340 virtual void Propagate(
const ChunkInfo &in_info,
1344 virtual void Backprop(
const ChunkInfo &in_info,
1364 virtual std::string
Type()
const {
return "DctComponent"; }
1365 virtual std::string Info()
const;
1368 void Init(
int32 dim,
int32 dct_dim,
bool reorder,
int32 keep_dct_dim=0);
1372 virtual void InitFromString(std::string args);
1374 virtual int32 OutputDim()
const {
return dct_mat_.NumRows() * (dim_ / dct_mat_.NumCols()); }
1376 virtual void Propagate(
const ChunkInfo &in_info,
1380 virtual void Backprop(
const ChunkInfo &in_info,
1390 virtual void Read(std::istream &is,
bool binary);
1391 virtual void Write(std::ostream &os,
bool binary)
const;
1416 virtual std::string
Type()
const {
return "FixedLinearComponent"; }
1417 virtual std::string Info()
const;
1423 virtual void InitFromString(std::string args);
1428 virtual void Propagate(
const ChunkInfo &in_info,
1432 virtual void Backprop(
const ChunkInfo &in_info,
1442 virtual void Read(std::istream &is,
bool binary);
1443 virtual void Write(std::ostream &os,
bool binary)
const;
1457 virtual std::string
Type()
const {
return "FixedAffineComponent"; }
1458 virtual std::string Info()
const;
1465 virtual void InitFromString(std::string args);
1470 virtual void Propagate(
const ChunkInfo &in_info,
1474 virtual void Backprop(
const ChunkInfo &in_info,
1484 virtual void Read(std::istream &is,
bool binary);
1485 virtual void Write(std::ostream &os,
bool binary)
const;
1504 virtual std::string
Type()
const {
return "FixedScaleComponent"; }
1505 virtual std::string Info()
const;
1511 virtual void InitFromString(std::string args);
1516 virtual void Propagate(
const ChunkInfo &in_info,
1520 virtual void Backprop(
const ChunkInfo &in_info,
1530 virtual void Read(std::istream &is,
bool binary);
1531 virtual void Write(std::ostream &os,
bool binary)
const;
1545 virtual std::string
Type()
const {
return "FixedBiasComponent"; }
1546 virtual std::string Info()
const;
1552 virtual void InitFromString(std::string args);
1557 virtual void Propagate(
const ChunkInfo &in_info,
1561 virtual void Backprop(
const ChunkInfo &in_info,
1571 virtual void Read(std::istream &is,
bool binary);
1572 virtual void Write(std::ostream &os,
bool binary)
const;
1592 void Init(
int32 dim,
1601 virtual void InitFromString(std::string args);
1603 virtual void Read(std::istream &is,
bool binary);
1605 virtual void Write(std::ostream &os,
bool binary)
const;
1607 virtual std::string
Type()
const {
return "DropoutComponent"; }
1614 virtual void Propagate(
const ChunkInfo &in_info,
1618 virtual void Backprop(
const ChunkInfo &in_info,
1625 virtual std::string Info()
const;
1642 virtual void InitFromString(std::string args);
1644 virtual void Read(std::istream &is,
bool binary);
1646 virtual void Write(std::ostream &os,
bool binary)
const;
1648 virtual std::string
Type()
const {
return "AdditiveNoiseComponent"; }
1656 virtual void Propagate(
const ChunkInfo &in_info,
1728 int32 InputDim()
const;
1729 int32 OutputDim()
const;
1735 std::string matrix_filename,
bool appended_conv);
1739 void Resize(
int32 input_dim,
int32 output_dim);
1740 std::string Info()
const;
1741 void InitFromString(std::string args);
1742 std::string
Type()
const {
return "Convolutional1dComponent"; }
1746 void Propagate(
const ChunkInfo &in_info,
1752 virtual void Backprop(
const ChunkInfo &in_info,
1759 void SetZero(
bool treat_as_gradient);
1760 void Read(std::istream &is,
bool binary);
1761 void Write(std::ostream &os,
bool binary)
const;
1769 int32 GetParameterDim()
const;
1778 static void ReverseIndexes(
const std::vector<int32> &forward_indexes,
1780 std::vector<std::vector<int32> > *backward_indexes);
1782 std::vector<std::vector<int32> > *out);
1805 std::vector<int32> *param);
virtual bool BackpropNeedsInput() const
virtual bool BackpropNeedsOutput() const
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
This kind of Component is a base-class for things like sigmoid and softmax.
LogSoftmaxComponent(int32 dim)
virtual Component * Copy() const
Copy component (deep copy).
virtual bool BackpropNeedsInput() const
virtual std::string Type() const
virtual int32 InputDim() const
Get size of input vectors.
virtual int32 InputDim() const
Get size of input vectors.
std::vector< int32 > offsets_
virtual Component * Copy() const
Copy component (deep copy).
CuVector< BaseFloat > bias_params_
FixedAffineComponent is an affine transform that is supplied at network initialization time and is no...
SigmoidComponent(const SigmoidComponent &other)
void MakeOffsetsContiguous()
void Check() const
Checks that the data in the ChunkInfo is valid, and die if not.
virtual bool BackpropNeedsInput() const
virtual int32 OutputDim() const
Get size of output vectors.
virtual int32 OutputDim() const
Get size of output vectors.
virtual int32 OutputDim() const
Get size of output vectors.
virtual bool BackpropNeedsInput() const
virtual int32 InputDim() const
Get size of input vectors.
BaseFloat max_change_per_sample_
virtual Component * Copy() const
Copy component (deep copy).
virtual int32 OutputDim() const
Get size of output vectors.
void Propagate(const ChunkInfo &in_info, const ChunkInfo &out_info, const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *out) const
A non-virtual propagate function that first resizes output if necessary.
CuMatrix< BaseFloat > filter_params_
virtual int32 OutputDim() const
Get size of output vectors.
SoftmaxComponent(int32 dim)
virtual int32 InputDim() const
Get size of input vectors.
PermuteComponent(int32 dim)
CuArray< Int32Pair > indexes_
const CuMatrix< BaseFloat > & LinearParams() const
Base class which provides matrix operations not involving resizing or allocation. ...
PermuteComponent(const std::vector< int32 > &reorder)
virtual std::string Type() const
void Init(const CuMatrixBase< BaseFloat > &matrix)
std::vector< int32 > context_
virtual int32 OutputDim() const
Get size of output vectors.
virtual std::vector< int32 > Context() const
Return a vector describing the temporal context this component requires for each frame of output...
virtual Component * Copy() const
Copy component (deep copy).
virtual bool BackpropNeedsInput() const
Abstract class, basic element of the network, it is a box with defined inputs, outputs, and tranformation functions interface.
virtual bool BackpropNeedsOutput() const
MaxpoolingComponent(int32 input_dim, int32 output_dim, int32 pool_size, int32 pool_stride)
virtual std::string Type() const
virtual bool BackpropNeedsInput() const
virtual int32 InputDim() const
Get size of input vectors.
virtual std::string Type() const
const CuVector< BaseFloat > & BiasParams()
virtual int32 InputDim() const
Get size of input vectors.
virtual bool BackpropNeedsInput() const
virtual void Backprop(const ChunkInfo &in_info, const ChunkInfo &out_info, const CuMatrixBase< BaseFloat > &in_value, const CuMatrixBase< BaseFloat > &out_value, const CuMatrixBase< BaseFloat > &out_deriv, Component *to_update, CuMatrix< BaseFloat > *in_deriv) const
Perform backward pass propagation of the derivative, and also either update the model (if to_update =...
ScaleComponent(const ScaleComponent &other)
virtual int32 OutputDim() const
Get size of output vectors.
virtual bool BackpropNeedsOutput() const
bool BackpropNeedsInput() const
UpdatableComponent(const UpdatableComponent &other)
bool BackpropNeedsOutput() const
virtual int32 InputDim() const
Get size of input vectors.
virtual int32 OutputDim() const
Get size of output vectors.
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
PermuteComponent does a permutation of the dimensions (by default, a fixed random permutation...
virtual std::string Type() const
This is a bit similar to dropout but adding (not multiplying) Gaussian noise with a given standard de...
#define KALDI_DISALLOW_COPY_AND_ASSIGN(type)
virtual int32 OutputDim() const
Get size of output vectors.
CuVector< double > deriv_sum_
virtual bool BackpropNeedsOutput() const
virtual bool BackpropNeedsInput() const
CuVector< BaseFloat > bias_
virtual int32 InputDim() const
Get size of input vectors.
virtual void Vectorize(VectorBase< BaseFloat > *params) const
Turns the parameters into vector form.
BaseFloat dropout_proportion_
virtual std::vector< int32 > Context() const
Return a vector describing the temporal context this component requires for each frame of output...
RectifiedLinearComponent(const RectifiedLinearComponent &other)
virtual std::vector< int32 > Context() const
Return a vector describing the temporal context this component requires for each frame of output...
virtual Component * Copy() const
Copy component (deep copy).
virtual std::string Type() const
void SetDropoutScale(BaseFloat scale)
ChunkInfo(int32 feat_dim, int32 num_chunks, const std::vector< int32 > offsets)
virtual bool BackpropNeedsInput() const
virtual int32 InputDim() const
Get size of input vectors.
virtual int32 InputDim() const
Get size of input vectors.
virtual void Update(const CuMatrixBase< BaseFloat > &in_value, const CuMatrixBase< BaseFloat > &out_deriv)
static const BaseFloat kNormFloor
virtual bool BackpropNeedsInput() const
virtual bool BackpropNeedsOutput() const
RectifiedLinearComponent(int32 dim)
Discrete cosine transform.
TanhComponent(const TanhComponent &other)
OnlinePreconditioner preconditioner_in_
virtual int32 InputDim() const
Get size of input vectors.
FixedScaleComponent applies a fixed per-element scale; it's similar to the Rescale component in the n...
virtual bool BackpropNeedsOutput() const
void SetMaxChange(BaseFloat max_change)
virtual int32 OutputDim() const
Get size of output vectors.
bool ParseFromString(const std::string &name, std::string *string, int32 *param)
Functions used in Init routines.
int32 GetOffset(int32 index) const
virtual bool BackpropNeedsOutput() const
virtual bool BackpropNeedsOutput() const
virtual bool BackpropNeedsInput() const
virtual std::string Type() const
virtual std::string Type() const
void Init(BaseFloat learning_rate)
virtual Component * Copy() const
Copy component (deep copy).
DropoutComponent(int32 dim, BaseFloat dp=0.5, BaseFloat sc=0.0)
BaseFloat num_samples_history_
virtual bool BackpropNeedsOutput() const
CuMatrix< BaseFloat > dct_mat_
AffineComponentPreconditioned()
virtual int32 InputDim() const
Get size of input vectors.
virtual bool BackpropNeedsOutput() const
virtual std::string Type() const
Take the absoute values of an input vector to a power.
virtual int32 InputDim() const
Get size of input vectors.
LogSoftmaxComponent(const LogSoftmaxComponent &other)
virtual bool BackpropNeedsOutput() const
virtual std::string Type() const
virtual int32 OutputDim() const
Get size of output vectors.
virtual std::string Type() const
BaseFloat learning_rate_
learning rate (0.0..0.01)
This Component, if present, randomly zeroes half of the inputs and multiplies the other half by two...
CuVector< BaseFloat > bias_params_
ChunkInfo is a class whose purpose is to describe the structure of matrices holding features...
virtual std::string Type() const
OnlinePreconditioner preconditioner_out_
CuVector< double > value_sum_
virtual bool BackpropNeedsInput() const
virtual int32 InputDim() const
Get size of input vectors.
SoftHingeComponent(int32 dim)
This is as SpliceComponent but outputs the max of any of the inputs (taking the max across time)...
virtual bool BackpropNeedsInput() const
virtual void Update(const CuMatrixBase< BaseFloat > &in_value, const CuMatrixBase< BaseFloat > &out_deriv)
virtual int32 OutputDim() const
Get size of output vectors.
const CuVector< double > & ValueSum() const
virtual int32 OutputDim() const
Get size of output vectors.
virtual bool BackpropNeedsOutput() const
virtual std::string Type() const
SoftmaxComponent(const SoftmaxComponent &other)
int32 const_component_dim_
virtual bool BackpropNeedsInput() const
virtual ~UpdatableComponent()
BaseFloat DotProduct(const Nnet &nnet1, const Nnet &nnet2)
Returns dot product between two networks of the same structure (calls the DotProduct functions of the...
virtual std::string Type() const
virtual bool BackpropNeedsOutput() const
virtual std::string Type() const
virtual std::string Type() const
NormalizeComponent(const NormalizeComponent &other)
SoftHingeComponent(const SoftHingeComponent &other)
FixedBiasComponent applies a fixed per-element bias; it's similar to the AddShift component in the nn...
virtual void SetIndex(int32 index)
virtual int32 Index() const
Returns the index in the sequence of layers in the neural net; intended only to be used in debugging ...
CuVector< BaseFloat > scales_
int32 NumRows() const
Returns the number of rows that we expect the feature matrix to have.
virtual bool BackpropNeedsInput() const
int32 GetIndex(int32 offset) const
virtual bool BackpropNeedsInput() const
NormalizeComponent(int32 dim)
AdditiveNoiseComponent(int32 dim, BaseFloat stddev)
virtual bool BackpropNeedsOutput() const
virtual bool BackpropNeedsOutput() const
CuMatrix< BaseFloat > linear_params_
virtual bool BackpropNeedsInput() const
virtual Component * Copy() const
Copy component (deep copy).
void CheckSize(const CuMatrixBase< BaseFloat > &mat) const
Checks that the matrix has the size we expect, and die if not.
MaxPoolingComponent : Maxpooling component was firstly used in ConvNet for selecting an representativ...
virtual int32 InputDim() const
Get size of input vectors.
virtual std::string Type() const
virtual bool BackpropNeedsOutput() const
virtual Component * Copy() const
Copy component (deep copy).
virtual int32 InputDim() const
Get size of input vectors.
FixedLinearComponent is a linear transform that is supplied at network initialization time and is not...
virtual bool BackpropNeedsInput() const
virtual int32 OutputDim() const
Get size of output vectors.
Matrix for CUDA computing.
virtual Component * Copy() const
Copy component (deep copy).
SigmoidComponent(int32 dim)
MatrixIndexT NumCols() const
std::vector< int32 > context_
virtual int32 GetParameterDim() const
The following new virtual function returns the total dimension of the parameters in this class...
PnormComponent(int32 input_dim, int32 output_dim, BaseFloat p)
virtual void Propagate(const ChunkInfo &in_info, const ChunkInfo &out_info, const CuMatrixBase< BaseFloat > &in, CuMatrixBase< BaseFloat > *out) const =0
Perform forward pass propagation Input->Output.
virtual std::string Type() const
virtual bool BackpropNeedsInput() const
virtual std::string Type() const
virtual std::string Type() const
virtual std::string Type() const
virtual void UnVectorize(const VectorBase< BaseFloat > ¶ms)
Converts the parameters from vector form.
virtual bool BackpropNeedsOutput() const
virtual int32 OutputDim() const
Get size of output vectors.
virtual bool BackpropNeedsOutput() const
#define KALDI_ASSERT(cond)
const CuMatrix< BaseFloat > & LinearParams()
std::vector< int32 > reorder_
virtual bool BackpropNeedsOutput() const
virtual bool BackpropNeedsOutput() const
virtual bool BackpropNeedsInput() const
Keywords: natural gradient descent, NG-SGD, naturalgradient.
virtual bool BackpropNeedsOutput() const
virtual int32 OutputDim() const
Get size of output vectors.
AffineComponentPreconditionedOnline()
virtual int32 OutputDim() const
Get size of output vectors.
RectifiedLinearComponent()
CuVector< BaseFloat > bias_params_
virtual int32 InputDim() const
Get size of input vectors.
void PerturbParams(BaseFloat stddev, Nnet *nnet)
Calls PerturbParams (with the given stddev) on all updatable components of the nnet.
PowerComponent(int32 dim, BaseFloat power=2)
virtual Component * Copy() const
Copy component (deep copy).
virtual std::string Type() const
const CuVector< double > & DerivSum() const
virtual bool BackpropNeedsInput() const
NonlinearComponent(int32 dim)
const CuMatrix< BaseFloat > & LinearParams()
virtual bool BackpropNeedsOutput() const
virtual Component * Copy() const
Copy component (deep copy).
virtual std::string Type() const
CuMatrix< BaseFloat > linear_params_
virtual int32 OutputDim() const
Get size of output vectors.
Keywords for search: natural gradient, naturalgradient, NG-SGD.
CuMatrix< BaseFloat > mat_
void SetLearningRate(BaseFloat lrate)
Sets the learning rate of gradient descent.
virtual std::string Type() const
Convolutional1dComponent implements convolution over frequency axis.
virtual std::string Type() const
MatrixIndexT NumRows() const
Dimensions.
Provides a vector abstraction class.
MaxoutComponent(int32 input_dim, int32 output_dim)
Splices a context window of frames together [over time].
virtual Component * Copy() const
Copy component (deep copy).
CuVector< BaseFloat > bias_params_
UpdatableComponent(BaseFloat learning_rate)
CuMatrix< BaseFloat > linear_params_
const CuVector< BaseFloat > & BiasParams()
BlockAffineComponentPreconditioned()
virtual std::string Type() const
BaseFloat LearningRate() const
Gets the learning rate of gradient descent.
virtual bool BackpropNeedsOutput() const
int32 NumCols() const
Returns the number of columns that we expect the feature matrix to have.
ChunkInfo(int32 feat_dim, int32 num_chunks, int32 first_offset, int32 last_offset)
void Resize(MatrixIndexT rows, MatrixIndexT cols, MatrixResizeType resize_type=kSetZero, MatrixStrideType stride_type=kDefaultStride)
Allocate the memory.
virtual bool BackpropNeedsInput() const
virtual bool BackpropNeedsInput() const
virtual std::string Type() const
virtual bool BackpropNeedsInput() const
virtual bool BackpropNeedsOutput() const
ScaleComponent(int32 dim, BaseFloat scale)
void RearrangeIndexes(const std::vector< std::vector< int32 > > &in, std::vector< std::vector< int32 > > *out)
virtual bool BackpropNeedsInput() const
Vector for CUDA computing.
CuRand< BaseFloat > random_generator_
CuArray< int32 > reverse_indexes_
virtual bool BackpropNeedsOutput() const
Class UpdatableComponent is a Component which has trainable parameters and contains some global param...
virtual std::string Type() const
virtual bool BackpropNeedsOutput() const
virtual int32 InputDim() const
Get size of input vectors.
void Copy(const CuMatrixBase< Real > &src, const CuArray< int32 > ©_from_indices, CuMatrixBase< Real > *tgt)
Copies elements from src into tgt as given by copy_from_indices.
virtual bool BackpropNeedsInput() const
virtual Component * Copy() const
Copy component (deep copy).
virtual int32 InputDim() const
Get size of input vectors.