Skip to content

Commit

Permalink
fix: infer device with index from density estimator.
Browse files Browse the repository at this point in the history
  • Loading branch information
janfb committed Jun 25, 2024
1 parent 6f61662 commit e798a03
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sbi/inference/snle/snle_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def build_posterior(
else:
likelihood_estimator = density_estimator
# Otherwise, infer it from the device of the net parameters.
device = next(density_estimator.parameters()).device.type
device = str(next(density_estimator.parameters()).device)

potential_fn, theta_transform = likelihood_estimator_based_potential(
likelihood_estimator=likelihood_estimator,
Expand Down
2 changes: 1 addition & 1 deletion sbi/inference/snpe/snpe_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def build_posterior(
else:
posterior_estimator = density_estimator
# Otherwise, infer it from the device of the net parameters.
device = next(density_estimator.parameters()).device.type
device = str(next(density_estimator.parameters()).device)

potential_fn, theta_transform = posterior_estimator_based_potential(
posterior_estimator=posterior_estimator,
Expand Down
2 changes: 1 addition & 1 deletion sbi/inference/snre/snre_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def build_posterior(
else:
ratio_estimator = density_estimator
# Otherwise, infer it from the device of the net parameters.
device = next(density_estimator.parameters()).device.type
device = str(next(density_estimator.parameters()).device)

potential_fn, theta_transform = ratio_estimator_based_potential(
ratio_estimator=ratio_estimator,
Expand Down

0 comments on commit e798a03

Please sign in to comment.