code: def _adjust_scalar_from_fx_to_onnx(
      dynamo_value: Union[
          torch.Tensor,
          int,
          float,
          bool,
      ],
      value_info: "onnx.ValueInfoProto",  # type: ignore[name-defined]
  ) -> torch.Tensor:
      """Helper function to wrap PyTorch variables as torch.Tensor"""
      if (
          isinstance(dynamo_value, torch.Tensor)
          and len(value_info.type.tensor_type.shape.dim) == 0
          and dynamo_value.shape == (1,)
      ):
          # ONNX expect a scalar with empty shape.
          # In contrast, PyTorch usually allows implicit
          # conversion between shape=() and shape=(1,).
          #
          # Below, PyTorch's shape (1,) is reshaped to ().
          return torch.squeeze(dynamo_value)
      elif isinstance(dynamo_value, int):
          return torch.tensor(dynamo_value, dtype=torch.int64)
      elif isinstance(dynamo_value, float):
          return torch.tensor(dynamo_value, dtype=torch.float32)
      elif isinstance(dynamo_value, bool):
          return torch.tensor(dynamo_value, dtype=torch.bool)
      else:
          assert isinstance(dynamo_value, torch.Tensor)
          return dynamo_value.contiguous()
  
imports: import dataclasses
  import importlib
  import logging
  from typing import Any, Dict, Final, List, Mapping, Optional, Sequence, Set, Tuple, Union
  from typing_extensions import TypeAlias
  import torch
  import torch._C
  import torch._ops
  import torch._prims.executor
  import torch.fx
  from torch._subclasses.fake_tensor import FakeTensor
  from torch.fx._compatibility import compatibility
  from torch.fx.passes.fake_tensor_prop import FakeTensorProp
  from torch.fx.passes.operator_support import OperatorSupport
  from torch.fx.passes.tools_common import CALLABLE_NODE_OPS
  from torch.utils import _pytree
label_desc: Use image node_id 15 for calling a global function with example usage: _adjust_scalar_from_fx_to_onnx(dynamo_value, value_info) and returns: torch, torch, torch, torch, dynamo_value