MCPcopy
hub / github.com/google-deepmind/alphagenome / jaxtyped

Function jaxtyped

src/alphagenome/typing.py:26–39  ·  view source on GitHub ↗

Wrapper around jaxtyping.jaxtyped that uses typeguard iff typeguard < 3.

(fn: _T)

Source from the content-addressed store, hash-verified

24
25
26def jaxtyped(fn: _T) -> _T:
27 """Wrapper around jaxtyping.jaxtyped that uses typeguard iff typeguard < 3."""
28 try:
29 major, *_ = importlib.metadata.version('typeguard').split('.')
30 except importlib.metadata.PackageNotFoundError:
31 major = -1
32
33 # Only use jaxtyping if typeguard is < 3. See
34 # https://docs.kidger.site/jaxtyping/api/runtime-type-checking/#runtime-type-checking
35 # for more details.
36 if int(major) < 3:
37 return jaxtyping.jaxtyped(fn, typechecker=typeguard.typechecked)
38 else:
39 return fn

Callers

nothing calls this directly

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected