Skip to content

Commit

Permalink
Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldeistler committed Apr 9, 2024
1 parent 728508c commit cceb940
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 20 deletions.
6 changes: 3 additions & 3 deletions sbi/inference/potentials/likelihood_based_potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

from sbi.inference.potentials.base_potential import BasePotential
from sbi.neural_nets.density_estimators import DensityEstimator
from sbi.neural_nets.mnle import MixedDensityEstimator
from sbi.sbi_types import TorchTransform
from sbi.utils import mcmc_transform
from sbi.neural_nets.density_estimators.shape_handling import (
reshape_to_batch_event,
reshape_to_sample_batch_event,
)
from sbi.neural_nets.mnle import MixedDensityEstimator
from sbi.sbi_types import TorchTransform
from sbi.utils import mcmc_transform


def likelihood_estimator_based_potential(
Expand Down
8 changes: 4 additions & 4 deletions sbi/inference/potentials/posterior_based_potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

from sbi.inference.potentials.base_potential import BasePotential
from sbi.neural_nets.density_estimators import DensityEstimator
from sbi.sbi_types import TorchTransform
from sbi.utils import mcmc_transform
from sbi.utils.sbiutils import within_support
from sbi.utils.torchutils import ensure_theta_batched
from sbi.neural_nets.density_estimators.shape_handling import (
reshape_to_batch_event,
reshape_to_sample_batch_event,
)
from sbi.sbi_types import TorchTransform
from sbi.utils import mcmc_transform
from sbi.utils.sbiutils import within_support
from sbi.utils.torchutils import ensure_theta_batched


def posterior_estimator_based_potential(
Expand Down
6 changes: 3 additions & 3 deletions sbi/inference/snle/mnle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
from sbi.inference.posteriors import MCMCPosterior, RejectionPosterior, VIPosterior
from sbi.inference.potentials import mixed_likelihood_estimator_based_potential
from sbi.inference.snle.snle_base import LikelihoodEstimator
from sbi.neural_nets.mnle import MixedDensityEstimator
from sbi.sbi_types import TensorboardSummaryWriter, TorchModule
from sbi.utils import check_prior, del_entries
from sbi.neural_nets.density_estimators.shape_handling import (
reshape_to_batch_event,
reshape_to_sample_batch_event,
)
from sbi.neural_nets.mnle import MixedDensityEstimator
from sbi.sbi_types import TensorboardSummaryWriter, TorchModule
from sbi.utils import check_prior, del_entries


class MNLE(LikelihoodEstimator):
Expand Down
2 changes: 1 addition & 1 deletion sbi/inference/snle/snle_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
from sbi.inference.posteriors import MCMCPosterior, RejectionPosterior, VIPosterior
from sbi.inference.potentials import likelihood_estimator_based_potential
from sbi.neural_nets import DensityEstimator, likelihood_nn
from sbi.utils import check_estimator_arg, check_prior, x_shape_from_simulation
from sbi.neural_nets.density_estimators.shape_handling import (
reshape_to_batch_event,
reshape_to_sample_batch_event,
)
from sbi.utils import check_estimator_arg, check_prior, x_shape_from_simulation


class LikelihoodEstimator(NeuralInference, ABC):
Expand Down
8 changes: 4 additions & 4 deletions sbi/inference/snpe/snpe_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
from sbi import utils as utils
from sbi.inference.posteriors.direct_posterior import DirectPosterior
from sbi.inference.snpe.snpe_base import PosteriorEstimator
from sbi.neural_nets.density_estimators.shape_handling import (
reshape_to_batch_event,
reshape_to_sample_batch_event,
)
from sbi.sbi_types import TensorboardSummaryWriter
from sbi.utils import (
batched_mixture_mv,
Expand All @@ -22,10 +26,6 @@
del_entries,
repeat_rows,
)
from sbi.neural_nets.density_estimators.shape_handling import (
reshape_to_batch_event,
reshape_to_sample_batch_event,
)


class SNPE_C(PosteriorEstimator):
Expand Down
2 changes: 1 addition & 1 deletion sbi/neural_nets/categorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from torch import nn, Tensor, unique
from torch import Tensor, nn, unique

from sbi.neural_nets.density_estimators import CategoricalMassEstimator, CategoricalNet

Expand Down
6 changes: 3 additions & 3 deletions sbi/neural_nets/mnle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# under the Affero General Public License v3, see <https://www.gnu.org/licenses/>.

import warnings
from typing import Optional, Tuple
from typing import Optional

import torch
from torch import Tensor, nn, unique
from torch import Tensor

from sbi.neural_nets.categorial import build_categoricalmassestimator
from sbi.neural_nets.density_estimators import MixedDensityEstimator
from sbi.neural_nets.density_estimators.mixed_density_estimator import _separate_input
from sbi.neural_nets.categorial import build_categoricalmassestimator
from sbi.neural_nets.flow import build_nsf
from sbi.utils.sbiutils import standardizing_net
from sbi.utils.user_input_checks import check_data_device
Expand Down
1 change: 0 additions & 1 deletion sbi/utils/user_input_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import torch
from numpy import ndarray
from pyknos.nflows import flows
from scipy.stats._distn_infrastructure import rv_frozen
from scipy.stats._multivariate import multi_rv_frozen
from torch import Tensor, float32, nn
Expand Down

0 comments on commit cceb940

Please sign in to comment.