Skip to content

Add Axon.namespace/2 and /3 - #652

Open
seanmor5 wants to merge 1 commit into
mainfrom
sm-namespace
Open

Add Axon.namespace/2 and /3#652
seanmor5 wants to merge 1 commit into
mainfrom
sm-namespace

Conversation

@seanmor5

Copy link
Copy Markdown
Contributor

No description provided.

Adds `Axon.namespace/2` and `Axon.namespace/3`, which wrap a subgraph
construction in a name prefix. Every layer built inside the closure has
its name prefixed with `prefix <> "."`; layers passed in from outer
scope, including inputs, are untouched.

Unlike `Axon.block/2` this introduces no extra graph node and performs
no parameter sharing - it only renames the leaves built within its
boundary. That lets builder functions use bare leaf names like
"q_proj" and leaves the caller to decide where the prefix applies at
composition time, instead of threading `name:` through every call.

The boundary is a `System.unique_integer([:positive, :monotonic])`
taken before the closure runs, which is the same generator used for
node ids, so nodes created inside the closure are exactly those with a
larger id. Namespaces nest, with the inner prefix applied first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants