class_docstr: Args:
class_docstr_tok: ["Args",":"]
code: def temporal_pool(x, n_segment):
      nt, c, h, w = x.size()
      n_batch = nt // n_segment
      x = x.view(n_batch, n_segment, c, h, w).transpose(
          1, 2
      )  # n, c, t, h, w
      x = F.max_pool3d(
          x, kernel_size=(3, 1, 1), stride=(2, 1, 1), padding=(1, 0, 0)
      )
      x = x.transpose(1, 2).contiguous().view(nt // 2, c, h, w)
      return x
  
file_path: towhee/towhee/models/tsm/temporal_shift.py
imports: import torch
  from torch import nn
  import torch.nn.functional
  import torchvision
label_desc: Use image node_id 3 for calling the TemporalPool obj's underlying member method code with example usage: obj.temporal_pool(x, n_segment) and returns: x