Published September 24, 2022
| Version v0.1.9
Software
Open
ASEM000/PyTreeClass: v0.1.9
Description
Changes
- Remove undocumented
array_as_leavesoption in.atmethods - Replace all dispatching with
isinstancefor speed ( notable speed improvements in all treeviz methods ) - Increase arrow length in
tree_mermaid. - Previously, any instance variable (static or dynamic) passed between
flatten/unflattenhad to be declared as adataclassfield. Now by default, all non-treeclassinstance variables are captured as static(i.e. part oftreedef) unless declared in thedataclassfields. for example
import pytreeclass as pytc
import jax.tree_util as jtu
@pytc.treeclass
class Test:
def __init__(self):
self.a=1
t = Test()
tt = jtu.tree_unflatten(*jtu.tree_flatten(t)[::-1])
# before change it will raise an error as
# `a` was not captured since it was not declared as dataclass field
tt.a # -> Error
# After change, it will be part of the treedef (i.e. static/nondiff field)
tt.a # 1
Full Changelog: https://github.com/ASEM000/PyTreeClass/compare/v0.1.8...v0.1.9
Files
ASEM000/PyTreeClass-v0.1.9.zip
Files
(152.2 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:e689a40084a3822b4d32762819bc2d2c
|
152.2 kB | Preview Download |
Additional details
Related works
- Is supplement to
- https://github.com/ASEM000/PyTreeClass/tree/v0.1.9 (URL)