2020
2121import numpy as np
2222import tensorflow as tf
23- from tensorflow .keras import Model
2423
2524from bayesflow .exceptions import ConfigurationError , SummaryStatsError
2625from bayesflow .losses import log_loss , mmd_summary_space , kl_dirichlet
@@ -59,7 +58,7 @@ def log_prob(input_dict, **kwargs):
5958 pass
6059
6160
62- class AmortizedPosterior (Model , AmortizedTarget ):
61+ class AmortizedPosterior (tf . keras . Model , AmortizedTarget ):
6362 """A wrapper to connect an inference network for parameter estimation with an optional summary network
6463 as in the original BayesFlow set-up described in the paper:
6564
@@ -115,7 +114,7 @@ def __init__(self, inference_net, summary_net=None, latent_dist=None, latent_is_
115114 any `sumamry_conditions`, i.e., `summary_conditions` should be set to None, otherwise these will be ignored.
116115 """
117116
118- Model .__init__ (self , ** kwargs )
117+ tf . keras . Model .__init__ (self , ** kwargs )
119118
120119 self .inference_net = inference_net
121120 self .summary_net = summary_net
@@ -409,7 +408,7 @@ def _determine_summary_loss(self, loss_fun):
409408 raise NotImplementedError ("Could not infer summary_loss_fun, argument should be of type (None, callable, or str)!" )
410409
411410
412- class AmortizedLikelihood (Model , AmortizedTarget ):
411+ class AmortizedLikelihood (tf . keras . Model , AmortizedTarget ):
413412 """An interface for a surrogate model of a simulator, or an implicit likelihood
414413 ``p(params | data, context).''
415414 """
@@ -427,7 +426,7 @@ def __init__(self, surrogate_net, latent_dist=None, **kwargs):
427426 a multivariate unit Gaussian.
428427 """
429428
430- Model .__init__ (self , ** kwargs )
429+ tf . keras . Model .__init__ (self , ** kwargs )
431430
432431 self .surrogate_net = surrogate_net
433432 self .latent_dim = self .surrogate_net .latent_dim
@@ -616,7 +615,7 @@ def _determine_latent_dist(self, latent_dist):
616615 return latent_dist
617616
618617
619- class AmortizedPosteriorLikelihood (Model , AmortizedTarget ):
618+ class AmortizedPosteriorLikelihood (tf . keras . Model , AmortizedTarget ):
620619 """An interface for jointly learning a surrogate model of the simulator and an approximate
621620 posterior given a generative model.
622621 """
@@ -632,7 +631,7 @@ def __init__(self, amortized_posterior, amortized_likelihood, **kwargs):
632631 The generative neural likelihood approximator.
633632 """
634633
635- Model .__init__ (self , ** kwargs )
634+ tf . keras . Model .__init__ (self , ** kwargs )
636635
637636 self .amortized_posterior = amortized_posterior
638637 self .amortized_likelihood = amortized_likelihood
0 commit comments