21 #ifndef KALDI_NNET3_NNET_SPECIAL_COMPONENT_H_ 22 #define KALDI_NNET3_NNET_SPECIAL_COMPONENT_H_ 137 virtual std::string
Info()
const;
139 virtual std::string
Type()
const {
return "ConvolutionComponent"; }
148 virtual void Backprop(
const std::string &debug_info,
156 void Update(
const std::string &debug_info,
162 virtual void Read(std::istream &is,
bool binary);
163 virtual void Write(std::ostream &os,
bool binary)
const;
192 std::string matrix_filename);
198 void Update(
const std::string &debug_info,
340 virtual std::string
Info()
const;
343 virtual std::string
Type()
const {
return "LstmNonlinearityComponent"; }
351 virtual void Backprop(
const std::string &debug_info,
360 virtual void Read(std::istream &is,
bool binary);
361 virtual void Write(std::ostream &os,
bool binary)
const;
380 void Init(
int32 cell_dim,
bool use_dropout,
392 void InitNaturalGradient();
492 pool_x_size_(0), pool_y_size_(0), pool_z_size_(0),
493 pool_x_step_(0), pool_y_step_(0), pool_z_step_(0) { }
500 virtual std::string
Info()
const;
502 virtual std::string
Type()
const {
return "MaxpoolingComponent"; }
511 virtual void Backprop(
const std::string &debug_info,
520 virtual void Read(std::istream &is,
bool binary);
524 virtual void Write(std::ostream &os,
bool binary)
const;
533 virtual void Check()
const;
718 virtual std::string
Info()
const;
720 GruNonlinearityComponent() { }
721 virtual std::string
Type()
const {
return "GruNonlinearityComponent"; }
729 virtual void Backprop(
const std::string &debug_info,
738 virtual void Read(std::istream &is,
bool binary);
739 virtual void Write(std::ostream &os,
bool binary)
const;
741 virtual Component*
Copy()
const {
return new GruNonlinearityComponent(*
this); }
756 explicit GruNonlinearityComponent(
757 const GruNonlinearityComponent &other);
794 int32 recurrent_dim_;
817 double self_repair_total_;
843 const GruNonlinearityComponent &
operator 844 = (
const GruNonlinearityComponent &other);
984 virtual std::string
Info()
const;
986 OutputGruNonlinearityComponent() { }
987 virtual std::string
Type()
const {
return "OutputGruNonlinearityComponent"; }
995 virtual void Backprop(
const std::string &debug_info,
1004 virtual void Read(std::istream &is,
bool binary);
1005 virtual void Write(std::ostream &os,
bool binary)
const;
1007 virtual Component*
Copy()
const {
return new OutputGruNonlinearityComponent(*
this); }
1022 explicit OutputGruNonlinearityComponent(
1023 const OutputGruNonlinearityComponent &other);
1079 double self_repair_total_;
1100 const OutputGruNonlinearityComponent &
operator 1101 = (
const OutputGruNonlinearityComponent &other);
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
virtual int32 OutputDim() const
Returns output-dimension of this component.
CuMatrix< double > value_sum_
virtual void InitFromConfig(ConfigLine *cfl)
Initialize, from a ConfigLine object.
virtual std::string Type() const
Returns a string such as "SigmoidComponent", describing the type of the object.
void InputToInputPatches(const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *patches) const
virtual void Vectorize(VectorBase< BaseFloat > *params) const
Turns the parameters into vector form.
virtual void Write(std::ostream &os, bool binary) const
Write component to stream.
void Init(int32 input_x_dim, int32 input_y_dim, int32 input_z_dim, int32 filt_x_dim, int32 filt_y_dim, int32 filt_x_step, int32 filt_y_step, int32 num_filters, TensorVectorizationType input_vectorization, BaseFloat param_stddev, BaseFloat bias_stddev)
virtual Component * Copy() const
Copies component (deep copy).
Base class which provides matrix operations not involving resizing or allocation. ...
Abstract base-class for neural-net components.
virtual std::string Info() const
Returns some text-form information about this component, for diagnostics.
virtual void UnVectorize(const VectorBase< BaseFloat > ¶ms)
Converts the parameters from vector form.
Keywords for search: natural gradient, naturalgradient, NG-SGD.
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
TensorVectorizationType input_vectorization_
virtual int32 NumParameters() const
The following new virtual function returns the total dimension of the parameters in this class...
virtual std::string Type() const
Returns a string such as "SigmoidComponent", describing the type of the object.
void SetParams(const VectorBase< BaseFloat > &bias, const MatrixBase< BaseFloat > &filter)
virtual void FreezeNaturalGradient(bool freeze)
freezes/unfreezes NaturalGradient updates, if applicable (to be overriden by components that use Natu...
virtual void Add(BaseFloat alpha, const Component &other)
This virtual function when called by – an UpdatableComponent adds the parameters of another updatabl...
virtual Component * Copy() const
Copies component (deep copy).
virtual int32 InputDim() const
Returns input-dimension of this component.
virtual int32 Properties() const
Return bitmask of the component's properties.
virtual void ZeroStats()
Components that provide an implementation of StoreStats should also provide an implementation of Zero...
virtual void Scale(BaseFloat scale)
This virtual function when called on – an UpdatableComponent scales the parameters by "scale" when c...
CuVector< BaseFloat > bias_params_
virtual int32 Properties() const
Return bitmask of the component's properties.
virtual void Read(std::istream &is, bool binary)
Read function (used after we know the type of the Component); accepts input that is missing the token...
CuMatrix< BaseFloat > filter_params_
This class is used for a piece of a CuMatrix.
CuVector< BaseFloat > self_repair_config_
CuMatrix< double > deriv_sum_
CuMatrix< BaseFloat > params_
Class UpdatableComponent is a Component which has trainable parameters; it extends the interface of C...
void Resize(int32 input_dim, int32 output_dim)
const CuVector< BaseFloat > & BiasParams() const
const ConvolutionComponent & operator=(const ConvolutionComponent &other)
Matrix for CUDA computing.
const CuMatrix< BaseFloat > & LinearParams() const
virtual void * Propagate(const ComponentPrecomputedIndexes *indexes, const CuMatrixBase< BaseFloat > &in, CuMatrixBase< BaseFloat > *out) const
Propagate function.
This class is responsible for parsing input like hi-there xx=yyy a=b c empty= f-oo=Append(bar, sss) ba_z=123 bing='a b c' baz="a b c d='a b' e" and giving you access to the fields, in this case.
virtual BaseFloat DotProduct(const UpdatableComponent &other) const
Computes dot-product between parameters of two instances of a Component.
virtual void ConsolidateMemory()
This virtual function relates to memory management, and avoiding fragmentation.
CuVector< double > self_repair_total_
virtual void Backprop(const std::string &debug_info, const ComponentPrecomputedIndexes *indexes, const CuMatrixBase< BaseFloat > &in_value, const CuMatrixBase< BaseFloat > &, const CuMatrixBase< BaseFloat > &out_deriv, void *memo, Component *to_update_in, CuMatrixBase< BaseFloat > *in_deriv) const
Backprop function; depending on which of the arguments 'to_update' and 'in_deriv' are non-NULL...
virtual int32 Properties() const
Return bitmask of the component's properties.
virtual void PerturbParams(BaseFloat stddev)
This function is to be used in testing.
virtual std::string Type() const
Returns a string such as "SigmoidComponent", describing the type of the object.
Provides a vector abstraction class.
void InderivPatchesToInderiv(const CuMatrix< BaseFloat > &in_deriv_patches, CuMatrixBase< BaseFloat > *in_deriv) const
WARNING, this component is deprecated in favor of TimeHeightConvolutionComponent, and will be deleted...
OnlineNaturalGradient preconditioner_
LstmNonlinearityComponent()
void Update(const std::string &debug_info, const CuMatrixBase< BaseFloat > &in_value, const CuMatrixBase< BaseFloat > &out_deriv, const std::vector< CuSubMatrix< BaseFloat > *> &out_deriv_batch)
Vector for CUDA computing.