Skip to content

Random assertions can fail randomly (despite seeding) #533

@penelopeysm

Description

@penelopeysm

e.g. this block in the VI tutorial:

```{julia}
#| echo: false
let
v, m = (mean(rand(q, 2000); dims=2)...,)
# On Turing version 0.14, this atol could be 0.01.
@assert isapprox(v, 1.022; atol=0.1) "Mean of s (VI posterior, 1000 samples): $v"
@assert isapprox(m, -0.027; atol=0.03) "Mean of m (VI posterior, 1000 samples): $m"
end
```

Somehow, these assertions failed in one CI run: https://github.com/TuringLang/docs/actions/runs/11281015562/job/31375300973

Here's another failure of the same code block: https://github.com/TuringLang/docs/actions/runs/11281201489/job/31376048754

Here's the Gaussian mixture model tutorial failing: https://github.com/TuringLang/docs/actions/runs/11283217753/job/31382221263

Not sure how this happened as the random seed was already set at the top of the file. It seems that some function isn't respecting it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions