docstr: Validate that custom inits have the correct type and shape, otherwise use defaults.
docstr_tok: ["Validate","that","custom","inits","have","the","correct","type","and","shape",",","otherwise","use","defaults","."]
code: def sanitize_custom_inits(default_inits, custom_inits):
      """Validate that custom inits have the correct type and shape, otherwise use defaults."""
      sanitized = {}
      for param in ["k", "m", "sigma_obs"]:
          try:
              sanitized[param] = float(custom_inits.get(param))
          except Exception:
              sanitized[param] = default_inits[param]
      for param in ["delta", "beta"]:
          if default_inits[param].shape == custom_inits[param].shape:
              sanitized[param] = custom_inits[param]
          else:
              sanitized[param] = default_inits[param]
      return sanitized
  
imports: from __future__ import absolute_import, division, print_function
  from abc import abstractmethod, ABC
  from dataclasses import dataclass
  from typing import Sequence, Tuple
  from collections import OrderedDict
  from enum import Enum
  import importlib_resources
  import platform
  import logging
label_desc: Use image node_id 6 for calling the CmdStanPyBackend obj's underlying member method code with example usage: obj.sanitize_custom_inits(default_inits, custom_inits) and returns: sanitized