There is a newer version of the record available.

Published September 24, 2022 | Version v0.1.9
Software Open

ASEM000/PyTreeClass: v0.1.9

Authors/Creators

  • 1. KAIST

Description

Changes
  • Remove undocumented array_as_leaves option in .at methods
  • Replace all dispatching with isinstance for speed ( notable speed improvements in all treeviz methods )
  • Increase arrow length in tree_mermaid.
  • Previously, any instance variable (static or dynamic) passed between flatten/unflatten had to be declared as a dataclass field. Now by default, all non-treeclass instance variables are captured as static(i.e. part of treedef) unless declared in the dataclass fields. 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