code: def test_pytorch_wrapper_thinc_input(ops_mixed, nN, nI, nO):
      import torch.nn
  
      ops, mixed_precision = ops_mixed
  
      with use_ops(ops.name):
          ops = get_current_ops()
          pytorch_layer = torch.nn.Linear(nO, nO)
          # Initialize with large weights to trigger overflow of FP16 in
          # mixed-precision training.
          torch.nn.init.uniform_(pytorch_layer.weight, 9.0, 11.0)
          device = get_torch_default_device()
          model = chain(
              Relu(),
              PyTorchWrapper_v2(
                  pytorch_layer.to(device),
                  mixed_precision=mixed_precision,
                  grad_scaler=PyTorchGradScaler(
                      enabled=mixed_precision, init_scale=2.0**16
                  ),
              ).initialize(),
          )
          # pytorch allocator is set in PyTorchShim
          if isinstance(ops, CupyOps):
              assert "pytorch" in context_pools.get()
          sgd = SGD(0.001)
          X = ops.xp.zeros((nN, nI), dtype="f")
          X += ops.xp.random.uniform(size=X.size).reshape(X.shape)
          Y = ops.xp.zeros((nN, nO), dtype="f")
          model.initialize(X, Y)
          Yh, get_dX = model.begin_update(X)
          assert isinstance(Yh, ops.xp.ndarray)
          assert Yh.shape == (nN, nO)
          dYh = (Yh - Y) / Yh.shape[0]
          dX = get_dX(dYh)
          model.finish_update(sgd)
          assert dX.shape == (nN, nI)
          check_learns_zero_output(model, sgd, X, Y)
          assert isinstance(model.predict(X), ops.xp.ndarray)
  
file_path: thinc/thinc/tests/layers/test_pytorch_wrapper.py
imports: import numpy
  import pytest
  from thinc.api import SGD, ArgsKwargs, CupyOps, Linear, MPSOps, NumpyOps, PyTorchWrapper, PyTorchWrapper_v2, PyTorchWrapper_v3, Relu, chain, get_current_ops, torch2xp, use_ops, xp2torch
  from thinc.backends import context_pools
  from thinc.compat import has_cupy_gpu, has_torch, has_torch_amp, has_torch_mps_gpu
  from thinc.layers.pytorchwrapper import PyTorchWrapper_v3
  from thinc.shims.pytorch import default_deserialize_torch_model, default_serialize_torch_model
  from thinc.shims.pytorch_grad_scaler import PyTorchGradScaler
  from thinc.util import get_torch_default_device
  from ..util import check_input_converters, make_tempdir
label_desc: Use image node_id 4 for calling a global function with example usage: test_pytorch_wrapper_thinc_input(ops_mixed, nN, nI, nO) without return types