code: def concat(
      value: Sequence[_T],
  ) -> _T:  # pylint: disable=too-many-return-statements
      """Concatenate row-wise."""
      if isinstance(value[0], np.ndarray):
          value_arr = cast(Sequence[np.ndarray], value)
          return np.concatenate(value_arr, axis=0)
      if scipy_sparse and isinstance(value[0], scipy_sparse.csr_matrix):
          return scipy_sparse.vstack(value, format="csr")
      if scipy_sparse and isinstance(value[0], scipy_sparse.csc_matrix):
          return scipy_sparse.vstack(value, format="csc")
      if scipy_sparse and isinstance(value[0], scipy_sparse.spmatrix):
          # other sparse format will be converted to CSR.
          return scipy_sparse.vstack(value, format="csr")
      if PANDAS_INSTALLED and isinstance(value[0], (DataFrame, Series)):
          return pandas_concat(value, axis=0)
      if lazy_isinstance(
          value[0], "cudf.core.dataframe", "DataFrame"
      ) or lazy_isinstance(value[0], "cudf.core.series", "Series"):
          from cudf import (
              concat as CUDF_concat,
          )  # pylint: disable=import-error
  
          return CUDF_concat(value, axis=0)
      from .data import _is_cupy_alike
  
      if _is_cupy_alike(value[0]):
          import cupy  # pylint: disable=import-error
  
          # pylint: disable=c-extension-no-member,no-member
          d = cupy.cuda.runtime.getDevice()
          for v in value:
              arr = cast(cupy.ndarray, v)
              d_v = arr.device.id
              assert (
                  d_v == d
              ), "Concatenating arrays on different devices."
          return cupy.concatenate(value, axis=0)
      raise TypeError("Unknown type.")
  
file_path: xgboost/python-package/xgboost/compat.py
imports: import importlib.util
  import logging
  import sys
  import types
  from typing import Any, Dict, List, Optional, Sequence, cast
  import numpy
  from ._typing import _T
label_desc: Use image node_id 6 for calling a global function with example usage: concat(value) and returns: np, scipy_sparse, scipy_sparse, scipy_sparse, pandas_concat, CUDF_concat, cupy