class_docstr: This class is for parsing lines like
  stats-layer name=tdnn1-stats config=mean+stddev(-99:3:9:99) input=tdnn1
  
  This adds statistics-pooling and statistics-extraction components.  An
  example string is 'mean(-99:3:9::99)', which means, compute the mean of
  data within a window of -99 to +99, with distinct means computed every 9
  frames (we round to get the appropriate one), and with the input extracted
  on multiples of 3 frames (so this will force the input to this layer to be
  evaluated every 3 frames).  Another example string is
  'mean+stddev(-99:3:9:99)', which will also cause the standard deviation to
  be computed.
  
  The dimension is worked out from the input. mean and stddev add a
  dimension of input_dim each to the output dimension. If counts is
  specified, an additional dimension is added to the output to store log
  counts.
  
  Parameters of the class, and their defaults:
      input='[-1]'    [Descriptor giving the input of the layer.]
      dim=-1      [Output dimension of layer. If provided, must match the
                   dimension computed from input]
      config=''   [Required. Defines what stats must be computed.]
class_docstr_tok: ["This","class","is","for","parsing","lines","like","stats-layer","name=tdnn1-stats","config=mean+stddev","(","-99:3:9:99",")","input=tdnn1","This","adds","statistics-pooling","and","statistics-extraction","components",".","An","example","string","is","'mean","(","-99:3:9",":",":99",")","'",",","which","means",",","compute","the","mean","of","data","within","a","window","of","-99","to","+99",",","with","distinct","means","computed","every","9","frames","(","we","round","to","get","the","appropriate","one",")",",","and","with","the","input","extracted","on","multiples","of","3","frames","(","so","this","will","force","the","input","to","this","layer","to","be","evaluated","every","3","frames",")",".","Another","example","string","is","'mean+stddev","(","-99:3:9:99",")","'",",","which","will","also","cause","the","standard","deviation","to","be","computed",".","The","dimension","is","worked","out","from","the","input",".","mean","and","stddev","add","a","dimension","of","input_dim","each","to","the","output","dimension",".","If","counts","is","specified",",","an","additional","dimension","is","added","to","the","output","to","store","log","counts",".","Parameters","of","the","class",",","and","their","defaults",":","input=","'","[","-1","]","'","[","Descriptor","giving","the","input","of","the","layer",".","]","dim=-1","[","Output","dimension","of","layer",".","If","provided",",","must","match","the","dimension","computed","from","input","]","config=","''","[","Required",".","Defines","what","stats","must","be","computed",".","]"]
code: def check_configs(self):
      if not (
          self._left_context >= 0
          and self._right_context >= 0
          and self._input_period > 0
          and self._stats_period > 0
          and self._left_context % self._stats_period == 0
          and self._right_context % self._stats_period == 0
          and self._stats_period % self._input_period == 0
      ):
          raise RuntimeError(
              "Invalid configuration of statistics-extraction: {0}".format(
                  self.config["config"]
              ),
              self,
          )
      super(XconfigStatsLayer, self).check_configs()
  
file_path: espnet/egs2/meld/asr1/steps/libs/nnet3/xconfig/stats_layer.py
imports: from __future__ import print_function
  import re
  from libs.nnet3.xconfig.basic_layers import XconfigLayerBase
label_desc: Use image node_id 4 for calling the XconfigStatsLayer obj's underlying member method code with example usage: obj.check_configs() without return types