MaxpoolingComponent Class Reference

#include <nnet-combined-component.h>

Inheritance diagram for MaxpoolingComponent:
Collaboration diagram for MaxpoolingComponent:

Public Member Functions

 MaxpoolingComponent ()
 
 MaxpoolingComponent (const MaxpoolingComponent &component)
 
virtual int32 InputDim () const
 Returns input-dimension of this component. More...
 
virtual int32 OutputDim () const
 Returns output-dimension of this component. More...
 
virtual std::string Info () const
 Returns some text-form information about this component, for diagnostics. More...
 
virtual void InitFromConfig (ConfigLine *cfl)
 Initialize, from a ConfigLine object. More...
 
virtual std::string Type () const
 Returns a string such as "SigmoidComponent", describing the type of the object. More...
 
virtual int32 Properties () const
 Return bitmask of the component's properties. More...
 
virtual void * Propagate (const ComponentPrecomputedIndexes *indexes, const CuMatrixBase< BaseFloat > &in, CuMatrixBase< BaseFloat > *out) const
 Propagate function. More...
 
virtual void Backprop (const std::string &debug_info, const ComponentPrecomputedIndexes *indexes, const CuMatrixBase< BaseFloat > &in_value, const CuMatrixBase< BaseFloat > &out_value, const CuMatrixBase< BaseFloat > &out_deriv, void *memo, Component *, CuMatrixBase< BaseFloat > *in_deriv) const
 Backprop function; depending on which of the arguments 'to_update' and 'in_deriv' are non-NULL, this can compute input-data derivatives and/or perform model update. More...
 
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 that describes the component type, in case it has already been consumed. More...
 
virtual void Write (std::ostream &os, bool binary) const
 Write component to stream. More...
 
virtual ComponentCopy () const
 Copies component (deep copy). More...
 
- Public Member Functions inherited from Component
virtual void StoreStats (const CuMatrixBase< BaseFloat > &in_value, const CuMatrixBase< BaseFloat > &out_value, void *memo)
 This function may store stats on average activation values, and for some component types, the average value of the derivative of the nonlinearity. More...
 
virtual void ZeroStats ()
 Components that provide an implementation of StoreStats should also provide an implementation of ZeroStats(), to set those stats to zero. More...
 
virtual void GetInputIndexes (const MiscComputationInfo &misc_info, const Index &output_index, std::vector< Index > *desired_indexes) const
 This function only does something interesting for non-simple Components. More...
 
virtual bool IsComputable (const MiscComputationInfo &misc_info, const Index &output_index, const IndexSet &input_index_set, std::vector< Index > *used_inputs) const
 This function only does something interesting for non-simple Components, and it exists to make it possible to manage optionally-required inputs. More...
 
virtual void ReorderIndexes (std::vector< Index > *input_indexes, std::vector< Index > *output_indexes) const
 This function only does something interesting for non-simple Components. More...
 
virtual ComponentPrecomputedIndexesPrecomputeIndexes (const MiscComputationInfo &misc_info, const std::vector< Index > &input_indexes, const std::vector< Index > &output_indexes, bool need_backprop) const
 This function must return NULL for simple Components. More...
 
virtual void Scale (BaseFloat scale)
 This virtual function when called on – an UpdatableComponent scales the parameters by "scale" when called by an UpdatableComponent. More...
 
virtual void Add (BaseFloat alpha, const Component &other)
 This virtual function when called by – an UpdatableComponent adds the parameters of another updatable component, times some constant, to the current parameters. More...
 
virtual void DeleteMemo (void *memo) const
 This virtual function only needs to be overwritten by Components that return a non-NULL memo from their Propagate() function. More...
 
virtual void ConsolidateMemory ()
 This virtual function relates to memory management, and avoiding fragmentation. More...
 
 Component ()
 
virtual ~Component ()
 

Protected Member Functions

void InputToInputPatches (const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *patches) const
 
void InderivPatchesToInderiv (const CuMatrix< BaseFloat > &in_deriv_patches, CuMatrixBase< BaseFloat > *in_deriv) const
 
virtual void Check () const
 

Protected Attributes

int32 input_x_dim_
 
int32 input_y_dim_
 
int32 input_z_dim_
 
int32 pool_x_size_
 
int32 pool_y_size_
 
int32 pool_z_size_
 
int32 pool_x_step_
 
int32 pool_y_step_
 
int32 pool_z_step_
 

Additional Inherited Members

- Static Public Member Functions inherited from Component
static ComponentReadNew (std::istream &is, bool binary)
 Read component from stream (works out its type). Dies on error. More...
 
static ComponentNewComponentOfType (const std::string &type)
 Returns a new Component of the given type e.g. More...
 

Detailed Description

Definition at line 488 of file nnet-combined-component.h.

Constructor & Destructor Documentation

◆ MaxpoolingComponent() [1/2]

◆ MaxpoolingComponent() [2/2]

MaxpoolingComponent ( const MaxpoolingComponent component)

Definition at line 698 of file nnet-combined-component.cc.

699  :
700  input_x_dim_(component.input_x_dim_),
701  input_y_dim_(component.input_y_dim_),
702  input_z_dim_(component.input_z_dim_),
703  pool_x_size_(component.pool_x_size_),
704  pool_y_size_(component.pool_y_size_),
705  pool_z_size_(component.pool_z_size_),
706  pool_x_step_(component.pool_x_step_),
707  pool_y_step_(component.pool_y_step_),
708  pool_z_step_(component.pool_z_step_) { }

Member Function Documentation

◆ Backprop()

void Backprop ( const std::string &  debug_info,
const ComponentPrecomputedIndexes indexes,
const CuMatrixBase< BaseFloat > &  in_value,
const CuMatrixBase< BaseFloat > &  out_value,
const CuMatrixBase< BaseFloat > &  out_deriv,
void *  memo,
Component to_update,
CuMatrixBase< BaseFloat > *  in_deriv 
) const
virtual

Backprop function; depending on which of the arguments 'to_update' and 'in_deriv' are non-NULL, this can compute input-data derivatives and/or perform model update.

Parameters
[in]debug_infoThe component name, to be printed out in any warning messages.
[in]indexesA pointer to some information output by this class's PrecomputeIndexes function (will be NULL for simple components, i.e. those that don't do things like splicing).
[in]in_valueThe matrix that was given as input to the Propagate function. Will be ignored (and may be empty) if Properties()&kBackpropNeedsInput == 0.
[in]out_valueThe matrix that was output from the Propagate function. Will be ignored (and may be empty) if Properties()&kBackpropNeedsOutput == 0
[in]out_derivThe derivative at the output of this component.
[in]memoThis will normally be NULL, but for component types that set the flag kUsesMemo, this will be the return value of the Propagate() function that corresponds to this Backprop() function. Ownership of any pointers is not transferred to the Backprop function; DeleteMemo() will be called to delete it.
[out]to_updateIf model update is desired, the Component to be updated, else NULL. Does not have to be identical to this. If supplied, you can assume that to_update->Properties() & kUpdatableComponent is nonzero.
[out]in_derivThe derivative at the input of this component, if needed (else NULL). If Properties()&kBackpropInPlace, may be the same matrix as out_deriv. If Properties()&kBackpropAdds, this is added to by the Backprop routine, else it is set. The component code chooses which mode to work in, based on convenience.

Implements Component.

Definition at line 875 of file nnet-combined-component.cc.

References CuMatrixBase< Real >::ColRange(), CuMatrixBase< Real >::EqualElementMask(), MaxpoolingComponent::InderivPatchesToInderiv(), MaxpoolingComponent::InputToInputPatches(), kaldi::kUndefined, CuMatrixBase< Real >::MulElements(), CuMatrixBase< Real >::NumRows(), NVTX_RANGE, MaxpoolingComponent::OutputDim(), MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_y_size_, and MaxpoolingComponent::pool_z_size_.

882  {
883  NVTX_RANGE("MaxpoolingComponent::Backprop");
884  if (!in_deriv)
885  return;
886 
887  int32 num_frames = in_value.NumRows();
888  int32 num_pools = OutputDim();
890  CuMatrix<BaseFloat> patches(num_frames, num_pools * pool_size, kUndefined);
891  InputToInputPatches(in_value, &patches);
892 
893  for (int32 q = 0; q < pool_size; q++) {
894  // zero-out mask
895  CuMatrix<BaseFloat> mask;
896  out_value.EqualElementMask(patches.ColRange(q * num_pools, num_pools), &mask);
897  mask.MulElements(out_deriv);
898  patches.ColRange(q * num_pools, num_pools).CopyFromMat(mask);
899  }
900 
901  // combine the derivatives from the individual input deriv patches
902  // to compute input deriv matrix
903  InderivPatchesToInderiv(patches, in_deriv);
904 }
void InputToInputPatches(const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *patches) const
void InderivPatchesToInderiv(const CuMatrix< BaseFloat > &in_deriv_patches, CuMatrixBase< BaseFloat > *in_deriv) const
kaldi::int32 int32
virtual int32 OutputDim() const
Returns output-dimension of this component.
#define NVTX_RANGE(name)
Definition: cu-common.h:143

◆ Check()

void Check ( ) const
protectedvirtual

Definition at line 719 of file nnet-combined-component.cc.

References MaxpoolingComponent::input_x_dim_, MaxpoolingComponent::input_y_dim_, MaxpoolingComponent::input_z_dim_, KALDI_ASSERT, MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_x_step_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_y_step_, MaxpoolingComponent::pool_z_size_, and MaxpoolingComponent::pool_z_step_.

Referenced by MaxpoolingComponent::InitFromConfig(), and MaxpoolingComponent::Read().

719  {
720  // sanity check of the max pooling parameters
739 }
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185

◆ Copy()

virtual Component* Copy ( ) const
inlinevirtual

Copies component (deep copy).

Implements Component.

Definition at line 525 of file nnet-combined-component.h.

References ConvolutionComponent::InderivPatchesToInderiv(), and ConvolutionComponent::InputToInputPatches().

◆ InderivPatchesToInderiv()

void InderivPatchesToInderiv ( const CuMatrix< BaseFloat > &  in_deriv_patches,
CuMatrixBase< BaseFloat > *  in_deriv 
) const
protected

Definition at line 828 of file nnet-combined-component.cc.

References CuMatrixBase< Real >::AddCols(), MaxpoolingComponent::input_x_dim_, MaxpoolingComponent::input_y_dim_, MaxpoolingComponent::input_z_dim_, KALDI_ASSERT, CuMatrixBase< Real >::NumCols(), MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_x_step_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_y_step_, MaxpoolingComponent::pool_z_size_, MaxpoolingComponent::pool_z_step_, and kaldi::nnet3::RearrangeIndexes().

Referenced by MaxpoolingComponent::Backprop().

830  {
831 
832  int32 num_pools_x = 1 + (input_x_dim_ - pool_x_size_) / pool_x_step_;
833  int32 num_pools_y = 1 + (input_y_dim_ - pool_y_size_) / pool_y_step_;
834  int32 num_pools_z = 1 + (input_z_dim_ - pool_z_size_) / pool_z_step_;
835 
836  std::vector<std::vector<int32> > reverse_column_map(in_deriv->NumCols());
837  int32 rev_col_map_size = reverse_column_map.size();
838  for (int32 x = 0, index = 0; x < pool_x_size_; x++) {
839  for (int32 y = 0; y < pool_y_size_; y++) {
840  for (int32 z = 0; z < pool_z_size_; z++) {
841 
842  for (int32 x_pool = 0; x_pool < num_pools_x; x_pool++) {
843  for (int32 y_pool = 0; y_pool < num_pools_y; y_pool++) {
844  for (int32 z_pool = 0; z_pool < num_pools_z; z_pool++, index++) {
845  int32 vector_index = (x_pool * pool_x_step_ + x) * input_y_dim_ * input_z_dim_ +
846  (y_pool * pool_y_step_ + y) * input_z_dim_ +
847  (z_pool * pool_z_step_ + z);
848 
849  KALDI_ASSERT(vector_index < rev_col_map_size);
850  reverse_column_map[vector_index].push_back(index);
851  }
852  }
853  }
854  }
855  }
856  }
857  std::vector<std::vector<int32> > rearranged_column_map;
858  RearrangeIndexes(reverse_column_map, &rearranged_column_map);
859  for (int32 p = 0; p < rearranged_column_map.size(); p++) {
860  CuArray<int32> cu_cols(rearranged_column_map[p]);
861  in_deriv->AddCols(in_deriv_patches, cu_cols);
862  }
863 }
kaldi::int32 int32
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185
void RearrangeIndexes(const std::vector< std::vector< int32 > > &in, std::vector< std::vector< int32 > > *out)

◆ Info()

std::string Info ( ) const
virtual

Returns some text-form information about this component, for diagnostics.

Starts with the type of the component. E.g. "SigmoidComponent dim=900", although most components will have much more info.

Reimplemented from Component.

Definition at line 953 of file nnet-combined-component.cc.

References MaxpoolingComponent::input_x_dim_, MaxpoolingComponent::input_y_dim_, MaxpoolingComponent::input_z_dim_, MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_x_step_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_y_step_, MaxpoolingComponent::pool_z_size_, MaxpoolingComponent::pool_z_step_, and MaxpoolingComponent::Type().

953  {
954  std::ostringstream stream;
955  stream << Type()
956  << ", input-x-dim=" << input_x_dim_
957  << ", input-y-dim=" << input_y_dim_
958  << ", input-z-dim=" << input_z_dim_
959  << ", pool-x-size=" << pool_x_size_
960  << ", pool-y-size=" << pool_y_size_
961  << ", pool-z-size=" << pool_z_size_
962  << ", pool-x-step=" << pool_x_step_
963  << ", pool-y-step=" << pool_y_step_
964  << ", pool-z-step=" << pool_z_step_;
965  return stream.str();
966 }
virtual std::string Type() const
Returns a string such as "SigmoidComponent", describing the type of the object.

◆ InitFromConfig()

void InitFromConfig ( ConfigLine cfl)
virtual

Initialize, from a ConfigLine object.

Parameters
[in]cflA ConfigLine containing any parameters that are needed for initialization. For example: "dim=100 param-stddev=0.1"

Implements Component.

Definition at line 742 of file nnet-combined-component.cc.

References MaxpoolingComponent::Check(), ConfigLine::GetValue(), ConfigLine::HasUnusedValues(), MaxpoolingComponent::input_x_dim_, MaxpoolingComponent::input_y_dim_, MaxpoolingComponent::input_z_dim_, KALDI_ERR, MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_x_step_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_y_step_, MaxpoolingComponent::pool_z_size_, MaxpoolingComponent::pool_z_step_, ConfigLine::UnusedValues(), and ConfigLine::WholeLine().

742  {
743  bool ok = true;
744 
745  ok = ok && cfl->GetValue("input-x-dim", &input_x_dim_);
746  ok = ok && cfl->GetValue("input-y-dim", &input_y_dim_);
747  ok = ok && cfl->GetValue("input-z-dim", &input_z_dim_);
748  ok = ok && cfl->GetValue("pool-x-size", &pool_x_size_);
749  ok = ok && cfl->GetValue("pool-y-size", &pool_y_size_);
750  ok = ok && cfl->GetValue("pool-z-size", &pool_z_size_);
751  ok = ok && cfl->GetValue("pool-x-step", &pool_x_step_);
752  ok = ok && cfl->GetValue("pool-y-step", &pool_y_step_);
753  ok = ok && cfl->GetValue("pool-z-step", &pool_z_step_);
754 
755  if (cfl->HasUnusedValues())
756  KALDI_ERR << "Could not process these elements in initializer: "
757  << cfl->UnusedValues();
758  if (!ok)
759  KALDI_ERR << "Bad initializer " << cfl->WholeLine();
760 
761  Check();
762 }
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ InputDim()

◆ InputToInputPatches()

void InputToInputPatches ( const CuMatrixBase< BaseFloat > &  in,
CuMatrix< BaseFloat > *  patches 
) const
protected

Definition at line 767 of file nnet-combined-component.cc.

References CuMatrixBase< Real >::CopyCols(), MaxpoolingComponent::input_x_dim_, MaxpoolingComponent::input_y_dim_, MaxpoolingComponent::input_z_dim_, KALDI_ASSERT, CuMatrixBase< Real >::NumCols(), MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_x_step_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_y_step_, MaxpoolingComponent::pool_z_size_, and MaxpoolingComponent::pool_z_step_.

Referenced by MaxpoolingComponent::Backprop(), and MaxpoolingComponent::Propagate().

769  {
770  int32 num_pools_x = 1 + (input_x_dim_ - pool_x_size_) / pool_x_step_;
771  int32 num_pools_y = 1 + (input_y_dim_ - pool_y_size_) / pool_y_step_;
772  int32 num_pools_z = 1 + (input_z_dim_ - pool_z_size_) / pool_z_step_;
773 
774  std::vector<int32> column_map(patches->NumCols());
775  int32 column_map_size = column_map.size();
776  for (int32 x = 0, index =0; x < pool_x_size_; x++) {
777  for (int32 y = 0; y < pool_y_size_; y++) {
778  for (int32 z = 0; z < pool_z_size_; z++) {
779  // given the local node coordinate, group them from each pool
780  // to form a patch
781  for (int32 x_pool = 0; x_pool < num_pools_x; x_pool++) {
782  for (int32 y_pool = 0; y_pool < num_pools_y; y_pool++) {
783  for (int32 z_pool = 0; z_pool < num_pools_z; z_pool++, index++) {
784  KALDI_ASSERT(index < column_map_size);
785  column_map[index] = (x_pool * pool_x_step_ + x) * input_y_dim_ * input_z_dim_ +
786  (y_pool * pool_y_step_ + y) * input_z_dim_ +
787  (z_pool * pool_z_step_ + z);
788 
789  }
790  }
791  }
792  }
793  }
794  }
795  CuArray<int32> cu_cols(column_map);
796  patches->CopyCols(in, cu_cols);
797 }
kaldi::int32 int32
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185

◆ OutputDim()

int32 OutputDim ( ) const
virtual

Returns output-dimension of this component.

Implements Component.

Definition at line 711 of file nnet-combined-component.cc.

References MaxpoolingComponent::input_x_dim_, MaxpoolingComponent::input_y_dim_, MaxpoolingComponent::input_z_dim_, MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_x_step_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_y_step_, MaxpoolingComponent::pool_z_size_, and MaxpoolingComponent::pool_z_step_.

Referenced by MaxpoolingComponent::Backprop(), and MaxpoolingComponent::Propagate().

◆ Propagate()

void * Propagate ( const ComponentPrecomputedIndexes indexes,
const CuMatrixBase< BaseFloat > &  in,
CuMatrixBase< BaseFloat > *  out 
) const
virtual

Propagate function.

Parameters
[in]indexesA pointer to some information output by this class's PrecomputeIndexes function (will be NULL for simple components, i.e. those that don't do things like splicing).
[in]inThe input to this component. Num-columns == InputDim().
[out]outThe output of this component. Num-columns == OutputDim(). Note: output of this component will be added to the initial value of "out" if Properties()&kPropagateAdds != 0; otherwise the output will be set and the initial value ignored. Each Component chooses whether it is more convenient implementation-wise to add or set, and the calling code has to deal with it.
Returns
Normally returns NULL, but may return a non-NULL value for components which have the flag kUsesMemo set. This value will be passed into the corresponding Backprop routine.

Implements Component.

Definition at line 810 of file nnet-combined-component.cc.

References CuMatrixBase< Real >::ColRange(), MaxpoolingComponent::InputToInputPatches(), kaldi::kUndefined, CuMatrixBase< Real >::Max(), CuMatrixBase< Real >::NumRows(), MaxpoolingComponent::OutputDim(), MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_z_size_, and CuMatrixBase< Real >::Set().

812  {
813  int32 num_frames = in.NumRows();
814  int32 num_pools = OutputDim();
816  CuMatrix<BaseFloat> patches(num_frames, num_pools * pool_size, kUndefined);
817  InputToInputPatches(in, &patches);
818 
819  out->Set(-1e20); // reset a large negative value
820  for (int32 q = 0; q < pool_size; q++)
821  out->Max(patches.ColRange(q * num_pools, num_pools));
822  return NULL;
823 }
void InputToInputPatches(const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *patches) const
kaldi::int32 int32
virtual int32 OutputDim() const
Returns output-dimension of this component.

◆ Properties()

◆ Read()

void Read ( std::istream &  is,
bool  binary 
)
virtual

Read function (used after we know the type of the Component); accepts input that is missing the token that describes the component type, in case it has already been consumed.

Implements Component.

Definition at line 906 of file nnet-combined-component.cc.

References MaxpoolingComponent::Check(), kaldi::ExpectOneOrTwoTokens(), kaldi::nnet3::ExpectToken(), MaxpoolingComponent::input_x_dim_, MaxpoolingComponent::input_y_dim_, MaxpoolingComponent::input_z_dim_, MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_x_step_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_y_step_, MaxpoolingComponent::pool_z_size_, MaxpoolingComponent::pool_z_step_, and kaldi::ReadBasicType().

906  {
907  ExpectOneOrTwoTokens(is, binary, "<MaxpoolingComponent>", "<InputXDim>");
908  ReadBasicType(is, binary, &input_x_dim_);
909  ExpectToken(is, binary, "<InputYDim>");
910  ReadBasicType(is, binary, &input_y_dim_);
911  ExpectToken(is, binary, "<InputZDim>");
912  ReadBasicType(is, binary, &input_z_dim_);
913  ExpectToken(is, binary, "<PoolXSize>");
914  ReadBasicType(is, binary, &pool_x_size_);
915  ExpectToken(is, binary, "<PoolYSize>");
916  ReadBasicType(is, binary, &pool_y_size_);
917  ExpectToken(is, binary, "<PoolZSize>");
918  ReadBasicType(is, binary, &pool_z_size_);
919  ExpectToken(is, binary, "<PoolXStep>");
920  ReadBasicType(is, binary, &pool_x_step_);
921  ExpectToken(is, binary, "<PoolYStep>");
922  ReadBasicType(is, binary, &pool_y_step_);
923  ExpectToken(is, binary, "<PoolZStep>");
924  ReadBasicType(is, binary, &pool_z_step_);
925  ExpectToken(is, binary, "</MaxpoolingComponent>");
926  Check();
927 }
void ReadBasicType(std::istream &is, bool binary, T *t)
ReadBasicType is the name of the read function for bool, integer types, and floating-point types...
Definition: io-funcs-inl.h:55
void ExpectOneOrTwoTokens(std::istream &is, bool binary, const std::string &token1, const std::string &token2)
This function is like ExpectToken but for two tokens, and it will either accept token1 and then token...
Definition: text-utils.cc:536
static void ExpectToken(const std::string &token, const std::string &what_we_are_parsing, const std::string **next_token)

◆ Type()

virtual std::string Type ( ) const
inlinevirtual

Returns a string such as "SigmoidComponent", describing the type of the object.

Implements Component.

Definition at line 502 of file nnet-combined-component.h.

Referenced by MaxpoolingComponent::Info().

502 { return "MaxpoolingComponent"; }

◆ Write()

void Write ( std::ostream &  os,
bool  binary 
) const
virtual

Write component to stream.

Implements Component.

Definition at line 929 of file nnet-combined-component.cc.

References MaxpoolingComponent::input_x_dim_, MaxpoolingComponent::input_y_dim_, MaxpoolingComponent::input_z_dim_, MaxpoolingComponent::pool_x_size_, MaxpoolingComponent::pool_x_step_, MaxpoolingComponent::pool_y_size_, MaxpoolingComponent::pool_y_step_, MaxpoolingComponent::pool_z_size_, MaxpoolingComponent::pool_z_step_, kaldi::WriteBasicType(), and kaldi::WriteToken().

929  {
930  WriteToken(os, binary, "<MaxpoolingComponent>");
931  WriteToken(os, binary, "<InputXDim>");
932  WriteBasicType(os, binary, input_x_dim_);
933  WriteToken(os, binary, "<InputYDim>");
934  WriteBasicType(os, binary, input_y_dim_);
935  WriteToken(os, binary, "<InputZDim>");
936  WriteBasicType(os, binary, input_z_dim_);
937  WriteToken(os, binary, "<PoolXSize>");
938  WriteBasicType(os, binary, pool_x_size_);
939  WriteToken(os, binary, "<PoolYSize>");
940  WriteBasicType(os, binary, pool_y_size_);
941  WriteToken(os, binary, "<PoolZSize>");
942  WriteBasicType(os, binary, pool_z_size_);
943  WriteToken(os, binary, "<PoolXStep>");
944  WriteBasicType(os, binary, pool_x_step_);
945  WriteToken(os, binary, "<PoolYStep>");
946  WriteBasicType(os, binary, pool_y_step_);
947  WriteToken(os, binary, "<PoolZStep>");
948  WriteBasicType(os, binary, pool_z_step_);
949  WriteToken(os, binary, "</MaxpoolingComponent>");
950 }
void WriteToken(std::ostream &os, bool binary, const char *token)
The WriteToken functions are for writing nonempty sequences of non-space characters.
Definition: io-funcs.cc:134
void WriteBasicType(std::ostream &os, bool binary, T t)
WriteBasicType is the name of the write function for bool, integer types, and floating-point types...
Definition: io-funcs-inl.h:34

Member Data Documentation

◆ input_x_dim_

◆ input_y_dim_

◆ input_z_dim_

◆ pool_x_size_

◆ pool_x_step_

◆ pool_y_size_

◆ pool_y_step_

◆ pool_z_size_

◆ pool_z_step_


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