Skip to content

Commit 5601d20

Browse files
committed
Merge branch 'normal_distribution_dimension' into compositional_sampling_diffusion
2 parents 89523a9 + 3eaff24 commit 5601d20

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bayesflow/approximators/continuous_approximator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,13 @@ def _sample(
536536
inference_conditions = keras.ops.broadcast_to(
537537
inference_conditions, (batch_size, num_samples, *keras.ops.shape(inference_conditions)[2:])
538538
)
539-
batch_shape = (
540-
batch_size,
541-
num_samples,
542-
)
539+
540+
if hasattr(self.inference_network, "base_distribution"):
541+
target_shape_len = len(self.inference_network.base_distribution.dims)
542+
else:
543+
# point approximator has no base_distribution
544+
target_shape_len = 1
545+
batch_shape = keras.ops.shape(inference_conditions)[:-target_shape_len]
543546
else:
544547
batch_shape = (num_samples,)
545548

0 commit comments

Comments
 (0)