Skip to content

Commit 4a8bf11

Browse files
authored
Add note to docs that (static) generative function definitions are expected to occur at the top level only
1 parent b013efb commit 4a8bf11

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/src/ref/modeling.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,10 @@ This will produce a file `test.pdf` in the current working directory containing
426426

427427
### Restrictions
428428

429-
In order to be able to construct the static graph, Gen restricts the permitted syntax that can be used in functions annotated with `static`.
429+
First, the definition of a `(static)` generative function is always expected to occur as a [top-level definition](https://docs.julialang.org/en/v1/manual/modules/) (aka global variable); usage in non–top-level scopes is unsupported and may result in incorrect behavior.
430+
Recall also that the macro [`@load_generated_functions`](@ref) is expected to be called as a top-level expression only.
431+
432+
Next, in order to be able to construct the static graph, Gen restricts the permitted syntax that can be used in functions annotated with `static`.
430433
In particular, each statement in the body must be one of the following:
431434

432435
- A `@param` statement specifying any [Trainable parameters](@ref), e.g.:

0 commit comments

Comments
 (0)