code: def chunk(input, chunks, dim=0):
      if ivy.shape(input) == ():
          return [input]
      else:
          dim_size = ivy.shape(input)[dim]
          chunk_size = dim_size // chunks
          if chunk_size == 0:
              return ivy.split(
                  input, num_or_size_splits=dim_size, axis=dim
              )
          else:
              remainder = dim_size % chunks
              if remainder == 0:
                  return ivy.split(
                      input, num_or_size_splits=chunks, axis=dim
                  )
              else:
                  return ivy.split(
                      input,
                      num_or_size_splits=tuple(
                          [chunk_size + remainder]
                          + [chunk_size] * (chunks - 1)
                      ),
                      axis=dim,
                  )
  
imports: import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape
  import ivy.functional.frontends.torch
label_desc: Use image node_id 4 for calling a global function with example usage: chunk(input, chunks, dim) and returns: list, ivy, ivy, ivy