code: def time_warp(spec, W=5):
      """Time warping
  
      :param torch.Tensor spec: input tensor with shape (T, dim)
      :param int W: time warp parameter
      """
      spec = spec.unsqueeze(0)
      spec_len = spec.shape[1]
      num_rows = spec.shape[2]
      device = spec.device
  
      y = num_rows // 2
      horizontal_line_at_ctr = spec[0, :, y]
      assert len(horizontal_line_at_ctr) == spec_len
  
      point_to_warp = horizontal_line_at_ctr[
          random.randrange(W, spec_len - W)
      ]
      assert isinstance(point_to_warp, torch.Tensor)
  
      # Uniform distribution from (0,W) with chance to be up to W negative
      dist_to_warp = random.randrange(-W, W)
      src_pts, dest_pts = (
          torch.tensor([[[point_to_warp, y]]], device=device),
          torch.tensor(
              [[[point_to_warp + dist_to_warp, y]]], device=device
          ),
      )
      warped_spectro, dense_flows = sparse_image_warp(
          spec, src_pts, dest_pts
      )
      return warped_spectro.squeeze(3).squeeze(0)
  
file_path: espnet/espnet/utils/spec_augment.py
imports: import random
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: time_warp(spec, W) and returns: warped_spectro