Skip to content

Define Axon.ModelState functions as transforms - #656

Merged
seanmor5 merged 1 commit into
mainfrom
worktree-fix-575-modelstate-defn
Aug 18, 2026
Merged

Define Axon.ModelState functions as transforms#656
seanmor5 merged 1 commit into
mainfrom
worktree-fix-575-modelstate-defn

Conversation

@seanmor5

@seanmor5 seanmor5 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Closes #575

Inside `defn` you can only call other `defn` functions or transforms,
so calling e.g. `Axon.ModelState.trainable_parameters/1` from a
numerical definition raised:

    cannot invoke Axon.ModelState.trainable_parameters/1 inside defn
    because it was not defined with defn

All of these functions only manipulate the model state tree, so they
are now `deftransform`. Since `deftransform` compiles down to a plain
`def` plus the defn export registration, callers outside of `defn` are
unaffected.

Closes #575

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@seanmor5
seanmor5 merged commit 1e86587 into main Aug 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Most Axon.ModelState functions should be defn or deftransform

2 participants