MultistreamComponent Class Reference

Class MultistreamComponent is an extension of UpdatableComponent for recurrent networks, which are trained with parallel sequences. More...

#include <nnet-component.h>

Inheritance diagram for MultistreamComponent:
Collaboration diagram for MultistreamComponent:

Public Member Functions

 MultistreamComponent (int32 input_dim, int32 output_dim)
 
bool IsMultistream () const
 Check if component has 'Recurrent' interface (trainable and recurrent),. More...
 
virtual void SetSeqLengths (const std::vector< int32 > &sequence_lengths)
 
int32 NumStreams () const
 
virtual void ResetStreams (const std::vector< int32 > &stream_reset_flag)
 Optional function to reset the transfer of context (not used for BLSTMs. More...
 
- Public Member Functions inherited from UpdatableComponent
 UpdatableComponent (int32 input_dim, int32 output_dim)
 
virtual ~UpdatableComponent ()
 
bool IsUpdatable () const
 Check if contains trainable parameters,. More...
 
virtual int32 NumParams () const =0
 Number of trainable parameters,. More...
 
virtual void GetGradient (VectorBase< BaseFloat > *gradient) const =0
 Get gradient reshaped as a vector,. More...
 
virtual void GetParams (VectorBase< BaseFloat > *params) const =0
 Get the trainable parameters reshaped as a vector,. More...
 
virtual void SetParams (const VectorBase< BaseFloat > &params)=0
 Set the trainable parameters from, reshaped as a vector,. More...
 
virtual void Update (const CuMatrixBase< BaseFloat > &input, const CuMatrixBase< BaseFloat > &diff)=0
 Compute gradient and update parameters,. More...
 
virtual void SetTrainOptions (const NnetTrainOptions &opts)
 Set the training options to the component,. More...
 
const NnetTrainOptionsGetTrainOptions () const
 Get the training options from the component,. More...
 
virtual void SetLearnRateCoef (BaseFloat val)
 Set the learn-rate coefficient,. More...
 
virtual void SetBiasLearnRateCoef (BaseFloat val)
 Set the learn-rate coefficient for bias,. More...
 
virtual void InitData (std::istream &is)=0
 Initialize the content of the component by the 'line' from the prototype,. More...
 
- Public Member Functions inherited from Component
 Component (int32 input_dim, int32 output_dim)
 Generic interface of a component,. More...
 
virtual ~Component ()
 
virtual ComponentCopy () const =0
 Copy component (deep copy),. More...
 
virtual ComponentType GetType () const =0
 Get Type Identification of the component,. More...
 
int32 InputDim () const
 Get the dimension of the input,. More...
 
int32 OutputDim () const
 Get the dimension of the output,. More...
 
void Propagate (const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *out)
 Perform forward-pass propagation 'in' -> 'out',. More...
 
void Backpropagate (const CuMatrixBase< BaseFloat > &in, const CuMatrixBase< BaseFloat > &out, const CuMatrixBase< BaseFloat > &out_diff, CuMatrix< BaseFloat > *in_diff)
 Perform backward-pass propagation 'out_diff' -> 'in_diff'. More...
 
void Write (std::ostream &os, bool binary) const
 Write the component to a stream,. More...
 
virtual std::string Info () const
 Print some additional info (after <ComponentName> and the dims),. More...
 
virtual std::string InfoGradient () const
 Print some additional info about gradient (after <...> and dims),. More...
 

Protected Attributes

std::vector< int32sequence_lengths_
 
- Protected Attributes inherited from UpdatableComponent
NnetTrainOptions opts_
 Option-class with training hyper-parameters,. More...
 
BaseFloat learn_rate_coef_
 Scalar applied to learning rate for weight matrices (to be used in ::Update method),. More...
 
BaseFloat bias_learn_rate_coef_
 Scalar applied to learning rate for bias (to be used in ::Update method),. More...
 
- Protected Attributes inherited from Component
int32 input_dim_
 Data members,. More...
 
int32 output_dim_
 Dimension of the output of the Component,. More...
 

Additional Inherited Members

- Public Types inherited from Component
enum  ComponentType {
  kUnknown = 0x0, kUpdatableComponent = 0x0100, kAffineTransform, kLinearTransform,
  kConvolutionalComponent, kLstmProjected, kBlstmProjected, kRecurrentComponent,
  kActivationFunction = 0x0200, kSoftmax, kHiddenSoftmax, kBlockSoftmax,
  kSigmoid, kTanh, kParametricRelu, kDropout,
  kLengthNormComponent, kTranform = 0x0400, kRbm, kSplice,
  kCopy, kTranspose, kBlockLinearity, kAddShift,
  kRescale, kKlHmm = 0x0800, kSentenceAveragingComponent, kSimpleSentenceAveragingComponent,
  kAveragePoolingComponent, kMaxPoolingComponent, kFramePoolingComponent, kParallelComponent,
  kMultiBasisComponent
}
 Component type identification mechanism,. More...
 
- Static Public Member Functions inherited from Component
static const char * TypeToMarker (ComponentType t)
 Converts component type to marker,. More...
 
static ComponentType MarkerToType (const std::string &s)
 Converts marker to component type (case insensitive),. More...
 
static ComponentInit (const std::string &conf_line)
 Initialize component from a line in config file,. More...
 
static ComponentRead (std::istream &is, bool binary)
 Read the component from a stream (static method),. More...
 
- Static Public Attributes inherited from Component
static const struct key_value kMarkerMap []
 The table with pairs of Component types and markers (defined in nnet-component.cc),. More...
 
- Protected Member Functions inherited from Component
virtual void PropagateFnc (const CuMatrixBase< BaseFloat > &in, CuMatrixBase< BaseFloat > *out)=0
 Abstract interface for propagation/backpropagation. More...
 
virtual void BackpropagateFnc (const CuMatrixBase< BaseFloat > &in, const CuMatrixBase< BaseFloat > &out, const CuMatrixBase< BaseFloat > &out_diff, CuMatrixBase< BaseFloat > *in_diff)=0
 Backward pass transformation (to be implemented by descending class...) More...
 
virtual void ReadData (std::istream &is, bool binary)
 Reads the component content. More...
 
virtual void WriteData (std::ostream &os, bool binary) const
 Writes the component content. More...
 

Detailed Description

Class MultistreamComponent is an extension of UpdatableComponent for recurrent networks, which are trained with parallel sequences.

Definition at line 281 of file nnet-component.h.

Constructor & Destructor Documentation

◆ MultistreamComponent()

MultistreamComponent ( int32  input_dim,
int32  output_dim 
)
inline

Definition at line 283 of file nnet-component.h.

283  :
284  UpdatableComponent(input_dim, output_dim)
285  { }
UpdatableComponent(int32 input_dim, int32 output_dim)

Member Function Documentation

◆ IsMultistream()

bool IsMultistream ( ) const
inlinevirtual

Check if component has 'Recurrent' interface (trainable and recurrent),.

Reimplemented from Component.

Definition at line 287 of file nnet-component.h.

287  {
288  return true;
289  }

◆ NumStreams()

◆ ResetStreams()

virtual void ResetStreams ( const std::vector< int32 > &  stream_reset_flag)
inlinevirtual

Optional function to reset the transfer of context (not used for BLSTMs.

Reimplemented in LstmProjected.

Definition at line 300 of file nnet-component.h.

Referenced by Nnet::ResetStreams().

301  { }

◆ SetSeqLengths()

virtual void SetSeqLengths ( const std::vector< int32 > &  sequence_lengths)
inlinevirtual

Reimplemented in ParallelComponent.

Definition at line 291 of file nnet-component.h.

Referenced by Nnet::SetSeqLengths().

291  {
292  sequence_lengths_ = sequence_lengths;
293  }
std::vector< int32 > sequence_lengths_

Member Data Documentation

◆ sequence_lengths_


The documentation for this class was generated from the following file: