Skip to content

Commit

Permalink
hotfix #206
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsKue committed Oct 11, 2024
1 parent ee0e9f1 commit 7f0dd0f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bayesflow/networks/deep_set/invariant_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
# Outer fully connected net for sum decomposition: inner( pooling( inner(set) ) )
self.outer_fc = keras.Sequential(name="InvariantOuterFC")
for _ in range(num_dense_outer):
if dropout is not None:
if dropout is not None and dropout > 0:
self.outer_fc.add(layers.Dropout(float(dropout)))

layer = layers.Dense(
Expand Down
2 changes: 1 addition & 1 deletion bayesflow/networks/mlp/hidden_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(
self.dense = layers.SpectralNormalization(self.dense)

if dropout is not None and dropout > 0.0:
self.dropout = layers.Dropout(dropout)
self.dropout = layers.Dropout(float(dropout))
else:
self.dropout = None

Expand Down
2 changes: 1 addition & 1 deletion bayesflow/networks/mlp/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
self.res_blocks.append(projector)

if dropout is not None and dropout > 0.0:
self.res_blocks.append(layers.Dropout(dropout))
self.res_blocks.append(layers.Dropout(float(dropout)))

for _ in range(depth):
self.res_blocks.append(
Expand Down
5 changes: 4 additions & 1 deletion bayesflow/networks/transformers/mab.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def __init__(
use_bias=use_bias,
)
)
self.feedforward.add(layers.Dropout(dropout))

if dropout is not None and dropout > 0:
self.feedforward.add(layers.Dropout(float(dropout)))

self.feedforward.add(layers.Dense(output_dim))
self.ln_post = layers.LayerNormalization() if layer_norm else None

Expand Down

0 comments on commit 7f0dd0f

Please sign in to comment.