code: def _potrf_batched(a):
      """Batched Cholesky decomposition.
  
      Decompose a given array of two-dimensional square matrices into
      ``L * L.T``, where ``L`` is a lower-triangular matrix and ``.T``
      is a conjugate transpose operator.
  
      Args:
          a (cupy.ndarray): The input array of matrices
              with dimension ``(..., N, N)``
  
      Returns:
          cupy.ndarray: The lower-triangular matrix.
      """
      from cupy_backends.cuda.libs import cublas
      from cupy_backends.cuda.libs import cusolver
      from cupyx.cusolver import check_availability
  
      if not check_availability("potrfBatched"):
          raise RuntimeError("potrfBatched is not available")
  
      dtype, out_dtype = _util.linalg_common_type(a)
      if a.size == 0:
          return cupy.empty(a.shape, out_dtype)
  
      if dtype == "f":
          potrfBatched = cusolver.spotrfBatched
      elif dtype == "d":
          potrfBatched = cusolver.dpotrfBatched
      elif dtype == "F":
          potrfBatched = cusolver.cpotrfBatched
      else:  # dtype == 'D':
          potrfBatched = cusolver.zpotrfBatched
  
      x = a.astype(dtype, order="C", copy=True)
      xp = cupy._core._mat_ptrs(x)
      n = x.shape[-1]
      ldx = x.strides[-2] // x.dtype.itemsize
      handle = device.get_cusolver_handle()
      batch_size = internal.prod(x.shape[:-2])
      dev_info = cupy.empty(batch_size, dtype=numpy.int32)
  
      potrfBatched(
          handle,
          cublas.CUBLAS_FILL_MODE_UPPER,
          n,
          xp.data.ptr,
          ldx,
          dev_info.data.ptr,
          batch_size,
      )
      cupy.linalg._util._check_cusolver_dev_info_if_synchronization_allowed(
          potrfBatched, dev_info
      )
  
      return cupy.tril(x).astype(out_dtype, copy=False)
  
file_path: cupy/cupy/linalg/_decomposition.py
imports: import numpy
  import cupy
  from cupy_backends.cuda.api import runtime
  from cupy._core import internal
  from cupy.cuda import device
  from cupy.linalg import _util
label_desc: Use image node_id 2 for calling a global function with example usage: _potrf_batched(a) and returns: cupy, cupy