code: def split_tensor_along_last_dim(
      tensor: torch.Tensor,
      num_partitions: int,
      contiguous_split_chunks: bool = False,
  ) -> List[torch.Tensor]:
      """Split a tensor along its last dimension.
      Arguments:
          tensor: input tensor.
          num_partitions: number of partitions to split the tensor
          contiguous_split_chunks: If True, make each chunk contiguous
                                   in memory.
      Returns:
          A list of Tensors
      """
      # Get the size and dimension.
      last_dim = tensor.dim() - 1
      last_dim_size = tensor.size()[last_dim] // num_partitions
      # Split.
      tensor_list = torch.split(tensor, last_dim_size, dim=last_dim)
      # Note: torch.split does not create contiguous tensors by default.
      if contiguous_split_chunks:
          return tuple(chunk.contiguous() for chunk in tensor_list)
  
      return tensor_list
  
file_path: BigDL/python/llm/src/bigdl/llm/transformers/models/chatglm2.py
imports: import math
  import torch
  from typing import Optional, Tuple, List
  import torch.nn.functional
  from transformers.modeling_outputs import BaseModelOutputWithPast
  from bigdl.llm.transformers.models.utils import init_kv_cache, extend_kv_cache, append_kv_cache
  from bigdl.llm.transformers.models.utils import use_flash_attention
  from bigdl.llm.transformers.models.llama import get_ipex_version
label_desc: Use image node_id 1 for calling a global function with example usage: split_tensor_along_last_dim(tensor, num_partitions, contiguous_split_chunks) and returns: tensor_list, tuple