code: def dataset_to_point_list(
      ds: Union[xarray.Dataset, dict[str, xarray.DataArray]],
      sample_dims: Sequence[str],
  ) -> Tuple[List[Dict[str, np.ndarray]], Dict[str, Any]]:
      # All keys of the dataset must be a str
      var_names = cast(List[str], list(ds.keys()))
      for vn in var_names:
          if not isinstance(vn, str):
              raise ValueError(
                  f"Variable names must be str, but dataset key {vn} is a {type(vn)}."
              )
      num_sample_dims = len(sample_dims)
      stacked_dims = {
          dim_name: ds[var_names[0]][dim_name]
          for dim_name in sample_dims
      }
      stacked_dict = {
          vn: da.transpose(*sample_dims, ...).values.reshape(
              (-1, *da.shape[num_sample_dims:])
          )
          for vn, da in ds.items()
      }
      points = [
          {vn: stacked_dict[vn][i, ...] for vn in var_names}
          for i in range(
              np.prod([len(coords) for coords in stacked_dims.values()])
          )
      ]
      # use the list of points
      return cast(List[Dict[str, np.ndarray]], points), stacked_dims
  
imports: import functools
  import warnings
  from typing import Any, Dict, List, NewType, Optional, Sequence, Tuple, Union, cast
  import arviz
  import cloudpickle
  import numpy
  import xarray
  from cachetools import LRUCache, cachedmethod
  from pytensor import Variable
  from pytensor.compile import SharedVariable
  from pytensor.graph.utils import ValidatingScratchpad
  from pymc.exceptions import BlockModelAccessError
label_desc: Use image node_id 9 for calling a global function with example usage: dataset_to_point_list(ds, sample_dims) and returns: cast,  stacked_dims