Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pymc/logprob/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def transform_scan_values(fgraph: FunctionGraph, node: Node) -> Optional[List[No
return None

transforms = [
values_to_transforms.get(rv_map_feature.original_values[value], None)
values_to_transforms.get(rv_map_feature.original_values[value_var], None)
for value_var in value_vars
]

Expand Down
7 changes: 6 additions & 1 deletion tests/logprob/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,13 @@ def test_scan_transform():
init = at.random.beta(1, 1, name="init")
init_vv = init.clone()

def scan_step(prev_innov):
next_innov = at.random.beta(prev_innov * 10, (1 - prev_innov) * 10)
update = {next_innov.owner.inputs[0]: next_innov.owner.outputs[0]}
return next_innov, update
Copy link
Member Author

@ricardoV94 ricardoV94 Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding more (non-probability related) outputs to scan showcases the bug.

Updates are a common output in real scan uses, so this is both more realistic and covers the fixed bug


innov, _ = scan(
fn=lambda prev_innov: at.random.beta(prev_innov * 10, (1 - prev_innov) * 10),
fn=scan_step,
outputs_info=[init],
n_steps=4,
)
Expand Down