class_docstr: Interface between a PyTorch model and a Thinc Model. This container is
  *not* a Thinc Model subclass itself.
  
  mixed_precision:
      Enable mixed-precision. This changes whitelisted ops to run
      in half precision for better performance and lower memory use.
  grad_scaler:
      The gradient scaler to use for mixed-precision training. If this
      argument is set to "None" and mixed precision is enabled, a gradient
      scaler with the default configuration is used.
  device:
      The PyTorch device to run the model on. When this argument is
      set to "None", the default device for the currently active Thinc
      ops is used.
  serialize_model:
      Callback that receives the wrapped PyTorch model as its argument and
      returns a "bytes" representation of the same. The representation should
      contain all the necessary information to fully deserialize the model.
  deserialize_model:
      Callback that receives the default PyTorch model (passed to the constructor), the
      serialized "bytes" representation and a PyTorch device. It should return a
      fully deserialized model on the target device as its result.
class_docstr_tok: ["Interface","between","a","PyTorch","model","and","a","Thinc","Model",".","This","container","is","*","not","*","a","Thinc","Model","subclass","itself",".","mixed_precision",":","Enable","mixed-precision",".","This","changes","whitelisted","ops","to","run","in","half","precision","for","better","performance","and","lower","memory","use",".","grad_scaler",":","The","gradient","scaler","to","use","for","mixed-precision","training",".","If","this","argument","is","set","to","``","None","''","and","mixed","precision","is","enabled",",","a","gradient","scaler","with","the","default","configuration","is","used",".","device",":","The","PyTorch","device","to","run","the","model","on",".","When","this","argument","is","set","to","``","None","''",",","the","default","device","for","the","currently","active","Thinc","ops","is","used",".","serialize_model",":","Callback","that","receives","the","wrapped","PyTorch","model","as","its","argument","and","returns","a","``","bytes","''","representation","of","the","same",".","The","representation","should","contain","all","the","necessary","information","to","fully","deserialize","the","model",".","deserialize_model",":","Callback","that","receives","the","default","PyTorch","model","(","passed","to","the","constructor",")",",","the","serialized","``","bytes","''","representation","and","a","PyTorch","device",".","It","should","return","a","fully","deserialized","model","on","the","target","device","as","its","result","."]
docstr: Pass inputs through to the underlying PyTorch model, and return the
  output. No conversions are performed. The PyTorch model is set into
  evaluation mode.
docstr_tok: ["Pass","inputs","through","to","the","underlying","PyTorch","model",",","and","return","the","output",".","No","conversions","are","performed",".","The","PyTorch","model","is","set","into","evaluation","mode","."]
code: def predict(self, inputs: ArgsKwargs) -> Any:
      """Pass inputs through to the underlying PyTorch model, and return the
      output. No conversions are performed. The PyTorch model is set into
      evaluation mode.
      """
      self._model.eval()
      with torch.no_grad():
          with torch.cuda.amp.autocast(self._mixed_precision):
              outputs = self._model(*inputs.args, **inputs.kwargs)
      self._model.train()
      return outputs
  
imports: import contextlib
  import itertools
  from io import BytesIO
  from typing import Any, Callable, Dict, Optional, cast
  import srsly
  from ..backends import CupyOps, context_pools, get_current_ops, set_gpu_allocator
  from ..compat import torch
  from ..optimizers import Optimizer
  from ..types import ArgsKwargs, FloatsXd
  from ..util import convert_recursive, get_torch_default_device, iterate_recursive, torch2xp, xp2torch
  from .pytorch_grad_scaler import PyTorchGradScaler
  from .shim import Shim
label_desc: Use image node_id 4 for calling the PyTorchShim obj's underlying member method code with example usage: obj.predict(inputs) and returns: outputs