code: def flatten(
      x: paddle.Tensor,
      /,
      *,
      copy: Optional[bool] = None,
      start_dim: Optional[int] = 0,
      end_dim: Optional[int] = -1,
      order: Optional[str] = "C",
      out: Optional[paddle.Tensor] = None,
  ) -> paddle.Tensor:
      ivy.utils.assertions.check_elem_in_list(order, ["C", "F"])
      if x.ndim == 0:
          return x.reshape((-1,))
  
      def _flatten(x, start_dim, end_dim):
          if x.dtype in [
              paddle.float16,
              paddle.complex64,
              paddle.complex128,
              paddle.bool,
          ]:
              if paddle.is_complex(x):
                  return paddle.complex(
                      paddle.flatten(
                          x.real(),
                          start_axis=start_dim,
                          stop_axis=end_dim,
                      ),
                      paddle.flatten(
                          x.imag(),
                          start_axis=start_dim,
                          stop_axis=end_dim,
                      ),
                  )
              return paddle.flatten(
                  x.cast("float32"),
                  start_axis=start_dim,
                  stop_axis=end_dim,
              ).cast(x.dtype)
          return paddle.flatten(
              x, start_axis=start_dim, stop_axis=end_dim
          )
  
      if order == "F":
          with ivy.ArrayMode(False):
              x = ivy.permute_dims(x, list(reversed(range(x.ndim))))
              ret = _flatten(x, start_dim, end_dim)
              return ivy.permute_dims(
                  ret, list(reversed(range(ret.ndim)))
              )
      return _flatten(x, start_dim, end_dim)
  
imports: from collections import namedtuple
  from typing import Iterable, Optional, Union, Sequence, Tuple, NamedTuple, List, Any, Literal, Callable
  from numbers import Number
  from ..None import backend_version
  from ivy.func_wrapper import with_supported_device_and_dtypes, with_unsupported_device_and_dtypes, with_supported_dtypes, with_unsupported_dtypes
  import paddle
  import ivy
  import ivy.functional.backends.paddle
  from ivy.functional.ivy.experimental.manipulation import _check_paddle_pad, _to_paddle_padding
label_desc: Use image node_id 11 for calling a global function with example usage: flatten() and returns: _flatten, x, paddle, paddle, ivy, paddle