Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions topomodelx/nn/hypergraph/allset.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AllSet(torch.nn.Module):
Dropout probability for the AllSet layer.
mlp_num_layers : int, default = 2
Number of layers in the MLP.
mlp_activation : torch.nn.Module, default = None
mlp_activation : callable | None, default = torch.nn.ReLU
Activation function in the MLP.
mlp_dropout : float, default = 0.0
Dropout probability for the MLP.
Expand All @@ -46,7 +46,7 @@ def __init__(
n_layers=2,
layer_dropout=0.2,
mlp_num_layers=2,
mlp_activation=None,
mlp_activation=torch.nn.ReLU,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 8b99f8f by updating the mlp_activation docstring to callable | None with default torch.nn.ReLU.

mlp_dropout=0.0,
mlp_norm=None,
**kwargs,
Expand Down
3 changes: 2 additions & 1 deletion topomodelx/nn/hypergraph/allset_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def __init__(
layers.append(nn.Linear(in_dim, hidden_dim, bias=bias))
if norm_layer is not None:
layers.append(norm_layer(hidden_dim))
layers.append(activation_layer(**params))
if activation_layer is not None:
layers.append(activation_layer(**params))
layers.append(nn.Dropout(dropout, **params))
in_dim = hidden_dim

Expand Down
5 changes: 3 additions & 2 deletions topomodelx/nn/hypergraph/allset_transformer_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def __init__(
number_queries: int = 1,
dropout: float = 0.0,
mlp_num_layers: int = 1,
mlp_activation=None,
mlp_activation=nn.ReLU,
mlp_dropout: float = 0.0,
mlp_norm=None,
initialization: Literal["xavier_uniform", "xavier_normal"] = "xavier_uniform",
Expand Down Expand Up @@ -455,7 +455,8 @@ def __init__(
layers.append(nn.Linear(in_dim, hidden_dim, bias=bias))
if norm_layer is not None:
layers.append(norm_layer(hidden_dim))
layers.append(activation_layer(**params))
if activation_layer is not None:
layers.append(activation_layer(**params))
layers.append(nn.Dropout(dropout, **params))
in_dim = hidden_dim

Expand Down