Skip to content

Commit 05f65bf

Browse files
committed
add a doc note that one should not broadcast to inference variables #258
1 parent 3ad23d6 commit 05f65bf

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

bayesflow/adapters/adapter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,12 @@ def broadcast(
338338
By default we exclude the last dimension (usually the data dimension) from broadcasting the size.
339339
squeeze : int or tuple, optional
340340
Axis to squeeze after broadcasting.
341+
342+
Notes
343+
-----
344+
Important: Do not broadcast to variables that are used as inference variables
345+
(i.e., parameters to be inferred by the networks). The adapter will work during training
346+
but then fail during inference because the variable being broadcasted to is not available.
341347
"""
342348
if isinstance(keys, str):
343349
keys = [keys]

bayesflow/adapters/transforms/broadcast.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ class Broadcast(Transform):
3333
squeeze : int or tuple, optional
3434
Axis to squeeze after broadcasting.
3535
36+
Notes
37+
-----
38+
Important: Do not broadcast to variables that are used as inference variables
39+
(i.e., parameters to be inferred by the networks). The adapter will work during training
40+
but then fail during inference because the variable being broadcasted to is not available.
41+
3642
Examples
3743
--------
3844
shape (1, ) array:

0 commit comments

Comments
 (0)