Skip to content

Commit 6e0cb67

Browse files
committed
FIX: type checking in the minimal example
1 parent b0b28ab commit 6e0cb67

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sbi/examples/minimal.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ def flexible():
4646
inference = SNPE(prior)
4747

4848
theta, x = simulate_for_sbi(simulator, proposal=prior, num_simulations=500)
49+
# The simulator returns a Tensor,
50+
# but `simulate_for_sbi` returns `Tensor | List[str]`.
51+
# To satisfy type checking, we assert that x is a Tensor.
52+
assert isinstance(x, torch.Tensor)
4953
density_estimator = inference.append_simulations(theta, x).train()
5054
posterior = inference.build_posterior(density_estimator)
5155
posterior.sample((100,), x=x_o)

0 commit comments

Comments
 (0)