code: def outputs_to_frontend_arrays(fn: Callable) -> Callable:
      @functools.wraps(fn)
      def outputs_to_frontend_arrays_torch(*args, **kwargs):
          """Convert `ivy.Array` into `Tensor` instances.
  
          Call the function, and then convert all `ivy.Array` instances returned by the
          function into `Tensor` instances.
          """
          # call unmodified function
          # ToDo: Remove this default dtype setting
          #  once frontend specific backend setting is added
          set_default_dtype = False
          if not (
              "dtype" in kwargs and ivy.exists(kwargs["dtype"])
          ) and all(
              not (ivy.is_array(i) or hasattr(i, "ivy_array"))
              for i in args
          ):
              if ivy.current_backend_str() == "jax":
                  import jax
  
                  jax.config.update("jax_enable_x64", True)
              ivy.set_default_int_dtype("int64")
              ivy.set_default_float_dtype(
                  torch_frontend.get_default_dtype()
              )
              set_default_dtype = True
          try:
              ret = fn(*args, **kwargs)
          finally:
              if set_default_dtype:
                  ivy.unset_default_int_dtype()
                  ivy.unset_default_float_dtype()
          # convert all arrays in the return to `torch_frontend.Tensor` instances
          ret = _from_ivy_array_to_torch_frontend_tensor(
              ret,
              nested=True,
              include_derived={"tuple": True},
              requires_grad=kwargs.get(
                  "requires_grad",
                  any(
                      isinstance(i, torch_frontend.Tensor)
                      and i.requires_grad
                      for i in args
                  ),
              ),
          )
  
          def array_fn(x):
              return ivy.is_array(x) or hasattr(x, "ivy_array")
  
          if "inplace" in kwargs and kwargs["inplace"]:
              first_array = ivy.func_wrapper._get_first_array(
                  *args, array_fn=array_fn, **kwargs
              )
              native_ret_data = ret.ivy_array.data
              if ivy.is_ivy_array(first_array):
                  first_array.data = native_ret_data
              elif ivy.is_native_array(first_array):
                  ivy.inplace_update(first_array, native_ret_data)
                  ret = torch_frontend.Tensor(
                      first_array, _init_overload=True
                  )
              else:
                  first_array.ivy_array.data = native_ret_data
                  ret = first_array
  
          # logic for setting is_leaf
          if ret is not None and isinstance(ret, torch_frontend.Tensor):
              if fn.__name__ in dir(torch_frontend.creation_ops):
                  ret.is_leaf = True
              elif all(
                  not isinstance(i, torch_frontend.Tensor)
                  or (not i.requires_grad and not i.grad_fn)
                  for i in args
              ):
                  ret.is_leaf = True
              else:
                  ret.is_leaf = False
          # set grad_fn
          if any(
              isinstance(i, torch_frontend.Tensor) and i.requires_grad
              for i in [*args, *kwargs.values()]
          ):
              # ToDo: Implement for unbind
              grad_fn = GradFn(fn, args, kwargs)
              grad_fn.__self__ = ret
              ret.grad_fn = grad_fn
  
          return ret
  
      outputs_to_frontend_arrays_torch.outputs_to_frontend_arrays_torch = (
          True
      )
      return outputs_to_frontend_arrays_torch
  
imports: import functools
  from typing import Callable
  import ivy
  import ivy.functional.frontends.torch
label_desc: Use image node_id 5 for calling a global function with example usage: outputs_to_frontend_arrays(fn) and returns: outputs_to_frontend_arrays_torch, ret, unknown