code: def _assert_array(args, dtype, scalar_check=False, casting="safe"):
      if args and dtype:
          if not scalar_check:
              ivy.utils.assertions.check_all_or_any_fn(
                  *args,
                  fn=lambda x: np_frontend.can_cast(
                      x, ivy.as_ivy_dtype(dtype), casting=casting
                  ),
                  type="all",
                  message=f"type of input is incompatible with dtype: {dtype}",
              )
          else:
              assert_fn = None if casting == "safe" else ivy.exists
              if ivy.is_bool_dtype(dtype):
                  assert_fn = ivy.is_bool_dtype
              if ivy.is_int_dtype(dtype):
  
                  def assert_fn(x):  # noqa F811
                      return not ivy.is_float_dtype(x)
  
              if assert_fn:
                  ivy.utils.assertions.check_all_or_any_fn(
                      *args,
                      fn=lambda x: (
                          assert_fn(x)
                          if ivy.shape(x) == ()
                          else np_frontend.can_cast(
                              x,
                              ivy.as_ivy_dtype(dtype),
                              casting=casting,
                          )
                      ),
                      type="all",
                      message=f"type of input is incompatible with dtype: {dtype}",
                  )
  
imports: import functools
  from typing import Callable, Any
  import inspect
  import platform
  import ivy
  import ivy.functional.frontends.numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _assert_array(args, dtype, scalar_check, casting) and returns: unknown