docstr: lage_aggregate function.
  
  Args:
      input: (Batch, Nsamples, Label_dim)
      input_lengths: (Batch)
  Returns:
      output: (Batch, Frames, Label_dim)
docstr_tok: ["lage_aggregate","function",".","Args",":","input",":","(","Batch",",","Nsamples",",","Label_dim",")","input_lengths",":","(","Batch",")","Returns",":","output",":","(","Batch",",","Frames",",","Label_dim",")"]
code: def label_aggregate(
      self, input: torch.Tensor, input_lengths: torch.Tensor = None
  ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]:
      """lage_aggregate function.
  
      Args:
          input: (Batch, Nsamples, Label_dim)
          input_lengths: (Batch)
      Returns:
          output: (Batch, Frames, Label_dim)
      """
      bs = input.size(0)
      max_length = input.size(1)
      label_dim = input.size(2)
  
      # NOTE(jiatong):
      #   The default behaviour of label aggregation is compatible with
      #   torch.stft about framing and padding.
  
      # Step1: center padding
      if self.center:
          pad = self.win_length // 2
          max_length = max_length + 2 * pad
          input = torch.nn.functional.pad(
              input, (0, 0, pad, pad), "constant", 0
          )
          input[:, :pad, :] = input[:, pad : (2 * pad), :]
          input[:, (max_length - pad) : max_length, :] = input[
              :, (max_length - 2 * pad) : (max_length - pad), :
          ]
          nframe = (max_length - self.win_length) // self.hop_length + 1
  
      # Step2: framing
      output = input.as_strided(
          (bs, nframe, self.win_length, label_dim),
          (
              max_length * label_dim,
              self.hop_length * label_dim,
              label_dim,
              1,
          ),
      )
  
      # Step3: aggregate label
      _tmp = output.sum(dim=-1, keepdim=False).float()
      output = _tmp[:, :, self.win_length // 2]
  
      # Step4: process lengths
      if input_lengths is not None:
          if self.center:
              pad = self.win_length // 2
              input_lengths = input_lengths + 2 * pad
  
          olens = (
              input_lengths - self.win_length
          ) // self.hop_length + 1
          output.masked_fill_(make_pad_mask(olens, output, 1), 0.0)
      else:
          olens = None
  
      return output, olens
  
imports: from typing import Any, Dict, Optional, Tuple, Union
  import torch
  from typeguard import check_argument_types
  from espnet2.tts.feats_extract.abs_feats_extract import AbsFeatsExtract
  from espnet.nets.pytorch_backend.nets_utils import make_pad_mask
label_desc: Use image node_id 5 for calling the FrameScoreFeats obj's underlying member method code with example usage: obj.label_aggregate(input, input_lengths) and returns: output,  olens