code: def _cholesky_solve(
      chol, rhs, name=None
  ):  # pylint: disable=unused-argument
      """Scipy cho_solve does not broadcast, so we must do so explicitly."""
      chol = ops.convert_to_tensor(chol)
      rhs = ops.convert_to_tensor(rhs)
      if JAX_MODE:
          (
              chol_broadcast,
              rhs_broadcast,
              rhs_batch_dims,
              result_permutation,
          ) = _create_solve_broadcastable_inputs(chol, rhs)
          result = scipy_linalg.cho_solve(
              (chol_broadcast, True), rhs_broadcast
          )
          return _reshape_solve_result(
              result, rhs_batch_dims, result_permutation
          )
      try:
          bcast_shp = np.broadcast_shapes(
              chol.shape[:-2], rhs.shape[:-2]
          )
      except ValueError as e:
          raise ValueError(
              f"Error with inputs shaped `chol`={chol.shape}, rhs={rhs.shape}"
          ) from e
      dim = chol.shape[-1]
      chol = np.broadcast_to(chol, bcast_shp + (dim, dim))
      rhs = np.broadcast_to(
          rhs,
          bcast_shp
          + (
              dim,
              rhs.shape[-1],
          ),
      )
      nbatch = int(np.prod(bcast_shp))
      flat_chol = chol.reshape(nbatch, dim, dim)
      flat_rhs = rhs.reshape(nbatch, dim, rhs.shape[-1])
      result = np.empty_like(flat_rhs)
      if np.size(result):
          for i, (ch, rh) in enumerate(zip(flat_chol, flat_rhs)):
              result[i] = scipy_linalg.cho_solve((ch, True), rh)
      return result.reshape(*rhs.shape)
  
imports: import collections
  import functools
  import numpy
  from tensorflow_probability.python.internal.backend.numpy import _utils
  from tensorflow_probability.python.internal.backend.numpy import ops
label_desc: Use image node_id 4 for calling a global function with example usage: _cholesky_solve(chol, rhs, name) and returns: result, _reshape_solve_result