class_docstr: MultiHeadDampedEMA module definition.
  
  Args:
      size: Module size.
      num_heads: Number of attention heads.
      activation: Activation function type.
      truncation_length: Maximum length for truncation.
docstr: Compute EMA kernel / vandermonde product.
  
  Args:
      length: Sequence length.
  
  Returns:
      : EMA kernel / Vandermonde product. (size, L)
code: def compute_ema_kernel(self, length: int) -> torch.Tensor:
      """Compute EMA kernel / vandermonde product.
  
      Args:
          length: Sequence length.
  
      Returns:
          : EMA kernel / Vandermonde product. (size, L)
  
      """
      self._kernel = None
  
      (
          damping_factor,
          prev_timestep_weight,
      ) = self.compute_ema_coefficients()
  
      vander = torch.arange(length).to(damping_factor).view(
          1, 1, length
      ) * torch.log(prev_timestep_weight)
      kernel = (damping_factor * self.ema_expansion_matrix) * torch.exp(
          vander
      )
  
      return torch.einsum(
          "dnl, dn -> dl",
          kernel,
          self.kernel_projection_matrix * self.scaling,
      )
  
file_path: espnet/espnet2/asr_transducer/decoder/modules/mega/multi_head_damped_ema.py
imports: import math
  from typing import Dict, Optional, Tuple, Union
  import torch
label_desc: Use image node_id 4 for calling the MultiHeadDampedEMA obj's underlying member method code with example usage: obj.compute_ema_kernel(length) and returns: torch