code: def narrow_trunc(
      input: Tensor, dim: int, start: int, length: int
  ) -> Tensor:
      return torch.narrow(
          input,
          dim,
          start,
          length
          if input.shape[dim] >= start + length
          else input.shape[dim] - start,
      )
  
file_path: stable-diffusion-webui/modules/sub_quadratic_attention.py
imports: from functools import partial
  import torch
  from torch import Tensor
  from torch.utils.checkpoint import checkpoint
  import math
  from typing import Optional, NamedTuple
label_desc: Use image node_id 1 for calling a global function with example usage: narrow_trunc(input, dim, start, length) and returns: torch