docstr: Initialises the backend
  
  1) retrieve the default backend name from the `TENSORLY_BACKEND` environment variable
      if not found, use _DEFAULT_BACKEND
  2) sets the backend to the retrieved backend name
docstr_tok: ["Initialises","the","backend","1",")","retrieve","the","default","backend","name","from","the","`","TENSORLY_BACKEND","`","environment","variable","if","not","found",",","use","_DEFAULT_BACKEND","2",")","sets","the","backend","to","the","retrieved","backend","name"]
code: def initialize_backend(cls):
      """Initialises the backend
  
      1) retrieve the default backend name from the `TENSORLY_BACKEND` environment variable
          if not found, use _DEFAULT_BACKEND
      2) sets the backend to the retrieved backend name
      """
      backend_name = os.environ.get(
          cls._ENV_DEFAULT_VAR, cls._default_backend
      )
      if backend_name not in cls.available_backend_names:
          msg = (
              f"{cls._ENV_DEFAULT_VAR} should be one of {''.join(map(repr, cls.available_backend_names))}"
              f", got {backend_name}. Defaulting to {cls._default_backend}'"
          )
          warnings.warn(msg, UserWarning)
          backend_name = cls._default_backend
  
      cls._default_backend = backend_name
      cls.set_backend(backend_name)
  
imports: import warnings
  from .core import Backend, backend_array
  import importlib
  import os
  import threading
  from contextlib import contextmanager
  import inspect
  import types
  import sys
label_desc: Use image node_id 8 for calling the BackendManager obj's underlying member method code with example usage: obj.initialize_backend(cls) without return types