Skip to content

Commit

Permalink
Add stable affine coupling flows
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanradev93 committed May 17, 2024
1 parent 51cb6a7 commit dc74968
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def split_parameters(self, parameters: Tensor) -> dict[str, Tensor]:
return {"scale": scale, "shift": shift}

def constrain_parameters(self, parameters: dict[str, Tensor]) -> dict[str, Tensor]:
# shift = math.log(math.e - 1)
s = parameters["scale"]
# parameters["scale"] = self.clamp_factor * ops.sigmoid(ops.softplus(parameters["scale"] + shift))
parameters["scale"] = 1 / (1 + ops.exp(-s)) * ops.sqrt(1 + ops.abs(s + self.clamp_factor))

return parameters
Expand Down
2 changes: 1 addition & 1 deletion bayesflow/experimental/networks/resnet/hidden_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ConfigurableHiddenBlock(keras.layers.Layer):
def __init__(
self,
num_units,
activation="relu",
activation="gelu",
residual=True,
dropout_rate=0.05,
spectral_norm=False,
Expand Down

0 comments on commit dc74968

Please sign in to comment.