code: def forward(self, input):
      # T, B, D -> B, D, T
      input = input.permute(1, 2, 0)
  
      if self.method == "mean" or self.method == "max":
          output = self.module(input)
          output = output.permute(2, 0, 1)
          return output
  
      full_seg_length = (
          input.size(2) // self.segment_size * self.segment_size
      )
      if full_seg_length > 0:
          # at least one seg is full
          B = input.size(0)
          D = input.size(1)
          input_todo = (
              input[:, :, :full_seg_length]
              .contiguous()
              .view(B, -1, self.segment_size)
          )
          output = self.module(input_todo)
          output = output.view(B, D, -1)
      else:
          output = input.new_zeros(input.size(0), input.size(1), 0)
      left = input.size(2) - full_seg_length
      if left > 0:
          # when last seg is not full, use zeros as last memory placeholder
          zeros = input.new_zeros(input.size(0), input.size(1), 1)
          output = torch.cat([output, zeros], dim=2)
      output = output.permute(2, 0, 1)
      return output
  
imports: import math
  import re
  from functools import partial
  from typing import List, Optional, Tuple
  import torch
  import torch.nn
  from torch import Tensor
  from torch import device
  from fairseq.models import FairseqEncoder
  from fairseq.models.speech_to_text.utils import NoOp, attention_suppression, layer_norm_backward_hook, lengths_to_padding_mask, segments_to_sequence
label_desc: Use image node_id 2 for calling the SummarizationLayer obj's underlying member method code with example usage: obj.forward(input) and returns: output, output