code: def _scalar_type_inference(value):
      if hasattr(value, "dtype"):
          dtype = str(value.dtype)
      elif isinstance(value, bool):
          dtype = "bool"
      elif isinstance(value, float):
          # We intentionally convert the float to float32 since it's more common in DL.
          dtype = "float32"
      elif isinstance(value, int):
          # We intentionally convert the python int to int32 since it's more common in DL.
          dtype = "int32"
      else:
          raise NotImplementedError(
              "Cannot automatically inference the type."
              " value={}".format(value)
          )
      return dtype
  
imports: from numbers import Number, Integral
  from ..None import _api_internal
  from ..ndarray._internal import NDArrayBase
  from .object import _ObjectBase, PyNativeObject, _set_node_generic
  from .base import string_types
label_desc: Use image node_id 1 for calling a global function with example usage: _scalar_type_inference(value) and returns: dtype