code: def test_scale_random_inputs(X):
      import torch
  
      device_id = torch.cuda.current_device()
      scaler = PyTorchGradScaler(enabled=True)
      scaler.to_(device_id)
  
      if is_torch_array(X):
          assert torch.allclose(scaler.scale(X), X * 2.0**16)
      else:
          scaled1 = scaler.scale(X)
          scaled2 = [t * 2.0**16 for t in X]
          for t1, t2 in zip(scaled1, scaled2):
              assert torch.allclose(t1, t2)
  
file_path: thinc/thinc/tests/shims/test_pytorch_grad_scaler.py
imports: import pytest
  from hypothesis import given, settings
  from hypothesis.strategies import lists, one_of, tuples
  from thinc.api import PyTorchGradScaler
  from thinc.compat import has_torch, has_torch_amp, has_torch_cuda_gpu, torch
  from thinc.util import is_torch_array
  from ..strategies import ndarrays
label_desc: Use image node_id 2 for calling a global function with example usage: test_scale_random_inputs(X) without return types