code: def set_backend(backend: str, dynamic: bool = False):
      """Set `backend` to be the global backend.
  
      Will also convert all Array and Container objects to the new backend if `dynamic` =
      True
  
      Examples
      --------
      If we set the global backend to be numpy, then subsequent calls to ivy functions
      will be called from Ivy's numpy backend:
  
      >>> ivy.set_backend("numpy")
      >>> native = ivy.native_array([1])
      >>> print(type(native))
      <class 'numpy.ndarray'>
  
      Or with jax as the global backend:
  
      >>> ivy.set_backend("jax")
      >>> native = ivy.native_array([1])
      >>> print(type(native))
      <class 'jaxlib.xla_extension.ArrayImpl'>
      """  # noqa
      ivy.utils.assertions.check_false(
          isinstance(backend, str) and backend not in _backend_dict,
          f"backend must be one from {list(_backend_dict.keys())}",
      )
  
      # update the global dict with the new backend
      with ivy.locks["backend_setter"]:
          global ivy_original_dict
          if not backend_stack:
              ivy_original_dict = ivy.__dict__.copy()
          _clear_current_sub_backends()
          if isinstance(backend, str):
              temp_stack = []
              while backend_stack:
                  temp_stack.append(previous_backend())
              backend = importlib.import_module(_backend_dict[backend])
              for fw in reversed(temp_stack):
                  backend_stack.append(fw)
          if backend.current_backend_str() == "numpy":
              ivy.set_default_device("cpu")
          elif backend.current_backend_str() == "jax":
              ivy.set_global_attr(
                  "RNG", ivy.functional.backends.jax.random.RNG
              )
          backend_stack.append(backend)
          set_backend_to_specific_version(backend)
          _set_module_backend(ivy_original_dict, ivy, backend)
          # following snippet is required to update the ivy.functional namespace with
          # backend-specific functions
          for key in ivy.__dict__.keys():
              if key in ivy.functional.__dict__ and not key.startswith(
                  "__"
              ):
                  ivy.functional.__dict__[key] = ivy.__dict__[key]
  
          if dynamic:
              dynamic_backend_converter(backend_stack)
          for sub_backend in ivy.available_sub_backends:
              ivy.set_sub_backend(sub_backend)
          if verbosity.level > 0:
              verbosity.cprint(f"backend stack: {backend_stack}")
      _handle_inplace_mode()
      return ivy
  
imports: import os
  import copy
  import types
  import ivy
  import importlib
  import functools
  import numpy
  import gc
  from ivy.utils import _importlib, verbosity
  from ivy.func_wrapper import _wrap_function
  from ivy.utils.backend.sub_backend_handler import _clear_current_sub_backends, fn_name_from_version_specific_fn_name
  from ivy.utils.exceptions import _handle_inplace_mode
label_desc: Use image node_id 10 for calling a global function with example usage: set_backend(backend, dynamic) and returns: ivy