class_docstr: TemporalCGAvgPool3D
code: def forward(self, x: Tensor) -> Tensor:
      input_shape = x.shape
      device = x.device
      cumulative_sum = torch.cumsum(x, dim=2)
      if self.activation is None:
          self.activation = cumulative_sum[:, :, -1:].clone()
      else:
          cumulative_sum += self.activation
          self.activation = cumulative_sum[:, :, -1:].clone()
      divisor = torch.arange(1, input_shape[2] + 1, device=device)[
          None, None, :, None, None
      ].expand(x.shape)
      x = cumulative_sum / (self.n_cumulated_values + divisor)
      self.n_cumulated_values += input_shape[2]
      return x
  
file_path: towhee/towhee/models/layers/temporal_cg_avgpool3d.py
imports: import torch
  from torch import Tensor
  from towhee.models.utils.causal_module import CausalModule
label_desc: Use image node_id 2 for calling the TemporalCGAvgPool3D obj's underlying member method code with example usage: obj.forward(x) and returns: x