code: def partial_unfold(
      x: Union[ivy.Array, ivy.NativeArray],
      /,
      mode: Optional[int] = 0,
      skip_begin: Optional[int] = 1,
      skip_end: Optional[int] = 0,
      ravel_tensors: Optional[bool] = False,
      *,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Partial unfolding of a tensor while ignoring the specified number of
      dimensions at the beginning and the end. For instance, if the first
      dimension of the tensor is the number of samples, to unfold each sample,
      set skip_begin=1. This would, for each i in ``range(tensor.shape[0])``,
      unfold ``tensor[i, ...]``.
  
      Parameters
      ----------
      x
          tensor of shape n_samples x n_1 x n_2 x ... x n_i
      mode
          indexing starts at 0, therefore mode is in range(0, tensor.ndim)
      skip_begin
          number of dimensions to leave untouched at the beginning
      skip_end
          number of dimensions to leave untouched at the end
      ravel_tensors
          if True, the unfolded tensors are also flattened
      out
          optional output array, for writing the result to.
  
      Returns
      -------
      ret
          partially unfolded tensor
      """
      if ravel_tensors:
          new_shape = [-1]
      else:
          new_shape = [x.shape[mode + skip_begin], -1]
  
      if skip_begin:
          new_shape = [
              x.shape[i] for i in range(skip_begin)
          ] + new_shape
  
      if skip_end:
          new_shape += [x.shape[-i] for i in range(1, 1 + skip_end)]
  
      return ivy.reshape(
          ivy.moveaxis(x, mode + skip_begin, skip_begin),
          new_shape,
          out=out,
      )
  
imports: from typing import Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List
  from numbers import Number
  from functools import partial
  import math
  import ivy
  from ivy.func_wrapper import handle_out_argument, handle_partial_mixed_function, to_native_arrays_and_back, inputs_to_native_shapes, handle_nestable, handle_array_like_without_promotion, handle_view, inputs_to_ivy_arrays, handle_array_function, handle_device, handle_backend_invalid
  from ivy.functional.ivy.general import _numel
  from ivy.utils.backend import current_backend
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 50 for calling a global function with example usage: partial_unfold(mode, skip_begin, skip_end, ravel_tensors) and returns: ivy