class_docstr: Define a basic interface for external models. Users can create subclasses
  of 'shim' to wrap external libraries. We provide shims for PyTorch.
  
  The Thinc Model class treats Shim objects as a sort of special type of
  sublayer: it knows they're not actual Thinc Model instances, but it also
  knows to talk to the shim instances when doing things like using transferring
  between devices, loading in parameters, optimization. It also knows Shim
  objects need to be serialized and deserialized with to/from bytes/disk,
  rather than expecting that they'll be msgpack-serializable.
class_docstr_tok: ["Define","a","basic","interface","for","external","models",".","Users","can","create","subclasses","of","'shim","'","to","wrap","external","libraries",".","We","provide","shims","for","PyTorch",".","The","Thinc","Model","class","treats","Shim","objects","as","a","sort","of","special","type","of","sublayer",":","it","knows","they","'re","not","actual","Thinc","Model","instances",",","but","it","also","knows","to","talk","to","the","shim","instances","when","doing","things","like","using","transferring","between","devices",",","loading","in","parameters",",","optimization",".","It","also","knows","Shim","objects","need","to","be","serialized","and","deserialized","with","to\/from","bytes\/disk",",","rather","than","expecting","that","they","'ll","be","msgpack-serializable","."]
code: def begin_update(
      self, fwd_args: Any
  ) -> Tuple[Any, Callable[..., Any]]:
      return self(fwd_args, is_train=True)
  
file_path: thinc/thinc/shims/shim.py
imports: import contextlib
  import copy
  import threading
  from pathlib import Path
  from typing import Any, Callable, Dict, Optional, Tuple, Union
label_desc: Use image node_id 4 for calling the Shim obj's underlying member method code with example usage: obj.begin_update(fwd_args) and returns: self