code: def _pack_as_tuple(tensor: Any) -> tuple:
      """Return a tuple of tensor with only one element if tensor it's not a tuple."""
      if isinstance(tensor, (tuple, list)):
          for t in tensor:
              if not isinstance(t, torch.Tensor):
                  raise TypeError(
                      f"All elements in the tuple must be of the same type (tensor), but got {type(t)}"
                  )
          return tuple(tensor)
      elif isinstance(tensor, torch.Tensor):
          return (tensor,)
      else:
          raise TypeError(f"Unsupported type {type(tensor)}")
  
imports: from __future__ import annotations
  from typing import Any, cast
  import torch
  import torch.nn
  from nni.mutable import Categorical, Mutable, Sample, SampleValidationError, MutableExpression, label_scope, auto_label
  from nni.nas.nn.pytorch import Repeat, recursive_freeze
  from .base import BaseSuperNetModule
  from .differentiable import DifferentiableMixedLayer, DifferentiableMixedInput
  from ._expression_utils import traverse_all_options
label_desc: Use image node_id 3 for calling a global function with example usage: _pack_as_tuple(tensor) and returns: tuple, tensor