mirror of
https://github.com/wassname/jaxtyping.git
synced 2026-09-11 12:21:38 +08:00
Now provides PyTreeDef, and can detect PyTrees via issubclass(x, PyTree)
This commit is contained in:
@@ -185,3 +185,11 @@ def test_pytree_namedtuple(typecheck):
|
||||
y=jax.random.normal(jax.random.PRNGKey(420), (2, 5)),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_subclass_pytree():
|
||||
x = PyTree
|
||||
y = PyTree[int]
|
||||
assert issubclass(x, PyTree)
|
||||
assert issubclass(y, PyTree)
|
||||
assert not issubclass(int, PyTree)
|
||||
|
||||
Reference in New Issue
Block a user