code: def flatten_outputs(
      outputs: Union[torch.Tensor, tf.Tensor, Iterable]
  ) -> List[Union[torch.Tensor, tf.Tensor]]:
      new_outputs = []
      for output in outputs:
          if isinstance(output, (torch.Tensor, tf.Tensor)):
              new_outputs.append(output)
          else:
              flatten_list = flatten_outputs(output)
              new_outputs.extend(flatten_list)
      return new_outputs
  
file_path: nebuly/optimization/nebullvm/nebullvm/tools/huggingface.py
imports: from collections import OrderedDict
  from typing import Union, Iterable, List, Dict, Tuple, Type, Any
  import numpy
  from nebullvm.core.models import Device, DeviceType
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.torch import torch, Module
label_desc: Use image node_id 1 for calling a global function with example usage: flatten_outputs(outputs) and returns: new_outputs