code: def pad_list(xs, pad_value):
      """Perform padding for the list of tensors.
  
      Args:
          xs (List): List of Tensors [(T_1, `*`), (T_2, `*`), ..., (T_B, `*`)].
          pad_value (float): Value for padding.
  
      Returns:
          Tensor: Padded tensor (B, Tmax, `*`).
  
      Examples:
          >>> x = [torch.ones(4), torch.ones(2), torch.ones(1)]
          >>> x
          [tensor([1., 1., 1., 1.]), tensor([1., 1.]), tensor([1.])]
          >>> pad_list(x, 0)
          tensor([[1., 1., 1., 1.],
                  [1., 1., 0., 0.],
                  [1., 0., 0., 0.]])
  
      """
      n_batch = len(xs)
      max_len = max(x.size(0) for x in xs)
      pad = (
          xs[0]
          .new(n_batch, max_len, *xs[0].size()[1:])
          .fill_(pad_value)
      )
  
      for i in range(n_batch):
          pad[i, : xs[i].size(0)] = xs[i]
  
      return pad
  
file_path: espnet/espnet/nets/pytorch_backend/nets_utils.py
imports: import logging
  from typing import Dict
  import numpy
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: pad_list(xs, pad_value) and returns: pad