class_docstr: Statistics and time average pooling (TAP) layer
  
  This computes mean and, optionally, standard deviation statistics across the time dimension.
  
  Args:
      feat_in: Input features with shape [B, D, T]
      pool_mode: Type of pool mode. Supported modes are 'xvector' (mean and standard deviation) and 'tap' (time
          average pooling, i.e., mean)
      eps: Epsilon, minimum value before taking the square root, when using 'xvector' mode.
      biased: Whether to use the biased estimator for the standard deviation when using 'xvector' mode. The default
          for torch.Tensor.std() is True.
  
  Returns:
      Pooled statistics with shape [B, D].
  
  Raises:
      ValueError if an unsupported pooling mode is specified.
class_docstr_tok: ["Statistics","and","time","average","pooling","(","TAP",")","layer","This","computes","mean","and",",","optionally",",","standard","deviation","statistics","across","the","time","dimension",".","Args",":","feat_in",":","Input","features","with","shape","[","B",",","D",",","T","]","pool_mode",":","Type","of","pool","mode",".","Supported","modes","are","'xvector","'","(","mean","and","standard","deviation",")","and","'tap","'","(","time","average","pooling",",","i.e.",",","mean",")","eps",":","Epsilon",",","minimum","value","before","taking","the","square","root",",","when","using","'xvector","'","mode",".","biased",":","Whether","to","use","the","biased","estimator","for","the","standard","deviation","when","using","'xvector","'","mode",".","The","default","for","torch.Tensor.std","(",")","is","True",".","Returns",":","Pooled","statistics","with","shape","[","B",",","D","]",".","Raises",":","ValueError","if","an","unsupported","pooling","mode","is","specified","."]
code: def forward(self, encoder_output, length=None):
      if length is None:
          mean = encoder_output.mean(dim=-1)  # Time Axis
          if self.pool_mode == "xvector":
              std = encoder_output.std(dim=-1)
              pooled = torch.cat([mean, std], dim=-1)
          else:
              pooled = mean
      else:
          mask = make_seq_mask_like(
              like=encoder_output, lengths=length, valid_ones=False
          )
          encoder_output = encoder_output.masked_fill(mask, 0.0)
          # [B, D, T] -> [B, D]
          means = encoder_output.mean(dim=-1)
          # Re-scale to get padded means
          means = means * (encoder_output.shape[-1] / length).unsqueeze(
              -1
          )
          if self.pool_mode == "xvector":
              stds = (
                  encoder_output.sub(means.unsqueeze(-1))
                  .masked_fill(mask, 0.0)
                  .pow(2.0)
                  .sum(-1)  # [B, D, T] -> [B, D]
                  .div(length.view(-1, 1).sub(1 if self.biased else 0))
                  .clamp(min=self.eps)
                  .sqrt()
              )
              pooled = torch.cat((means, stds), dim=-1)
          else:
              pooled = means
      return pooled
  
imports: from typing import List
  import torch
  from numpy import inf
  from torch import nn
  from torch.nn import functional
  from nemo.collections.asr.parts.submodules.jasper import get_same_padding, init_weights
label_desc: Use image node_id 2 for calling the StatsPoolLayer obj's underlying member method code with example usage: obj.forward(encoder_output, length) and returns: pooled