code: def create_sparse_wrapped(
      indices: List[torch.Tensor],
      values: torch.Tensor,
      size: Optional[
          Union[Tuple[int, int], Tuple[int, int, int]]
      ] = None,
      min_col_index: Optional[int] = None,
  ) -> torch.Tensor:
      """Wraps up k2.create_sparse to create 2- or 3-dimensional sparse tensors."""
      assert size is None or len(indices) == len(size)
  
      if len(indices) == 2:
          return k2.create_sparse(
              rows=indices[0],
              cols=indices[1],
              values=values,
              size=size,
              min_col_index=min_col_index,
          )
      elif len(indices) == 3:
          assert (
              indices[0].ndim == indices[1].ndim == indices[2].ndim == 1
          )
          assert (
              indices[0].numel()
              == indices[1].numel()
              == indices[2].numel()
              == values.numel()
          )
  
          if min_col_index is not None:
              assert isinstance(min_col_index, int)
              kept_indices = indices[-1] >= min_col_index
              indices = [i[kept_indices] for i in indices]
              values = values[kept_indices]
          if size is not None:
              return torch.sparse_coo_tensor(
                  torch.stack(indices),
                  values,
                  size=size,
                  device=values.device,
                  requires_grad=values.requires_grad,
              )
          else:
              return torch.sparse_coo_tensor(
                  torch.stack(indices),
                  values,
                  device=values.device,
                  requires_grad=values.requires_grad,
              )
      else:
          raise ValueError(f"len(indices) = {len(indices)}")
  
imports: import os
  import struct
  from pickle import UnpicklingError
  from typing import List, Optional, Tuple, Union
  import torch
  from nemo.core.utils.k2_guard import k2
  from nemo.utils import logging
label_desc: Use image node_id 9 for calling a global function with example usage: create_sparse_wrapped(indices, values, size, min_col_index) and returns: k2, torch, torch