phlower.nn.SimilarityEquivariantMLP¶
- class phlower.nn.SimilarityEquivariantMLP(nodes, scale_names, activations=None, dropouts=None, bias=True, create_linear_weight=False, norm_function_name='identity', disable_en_equivariance=False, invariant=False, centering=False, coeff_amplify=1.0, cross_interaction=False, normalize=True, unbatch=True)[source]¶
Bases:
IPhlowerCoreModule
,Module
Similarity-equivariant Multi Layer Perceptron as in https://proceedings.mlr.press/v235/horie24a.html.
- Parameters:
nodes (list[int]) – List of feature dimension sizes (The last value of tensor shape).
scale_names (dict[str, str]) – Name of scales to be used to convert input features to dimensionless. Keys should be PhysicalDimensionSymbolType (T, L, M, …) and values should be names of fields.
activations (list[str] | None (optional)) – List of activation functions to apply to the output. Defaults to None.
dropouts (list[float] | None (optional)) – List of dropout rates to apply to the output. Defaults to None.
bias (bool) – Whether to use bias.
create_linear_weight (bool) – Whether to create a linear weight.
norm_function_name (str) – Name of the normalization function to apply to the output. Defaults to “identity”.
disable_en_equivariance (bool) – Whether to disable en-equivariance.
invariant (bool) – Whether to make the output invariant to the input.
centering (bool) – Whether to center the output.
coeff_amplify (float) – Coefficient to amplify the output.
cross_interaction (bool) – If True, use interaction layer proposed by https://arxiv.org/abs/2203.06442.
normalize (bool) – If True, use eq (12) in https://arxiv.org/abs/2203.06442 when cross_interaction is True.
unbatch (bool) – If True, perform unbatching. Set False when you call this module from another module which perform unbaching. Note that this option cannot be set from yaml. Default: True
Examples
>>> similarity_equivariant_mlp = SimilarityEquivariantMLP( ... nodes=[10, 20, 30], ... scale_names={"T": "time", "L": "length"}, ... activations=["relu", "relu", "relu"], ... dropouts=[0.1, 0.1, 0.1], ... bias=True, ... create_linear_weight=True, ... norm_function_name="identity", ... disable_en_equivariance=False, ... invariant=False, ... centering=False, ... coeff_amplify=1.0, ... cross_interaction=False, ... normalize=True, ... ) >>> similarity_equivariant_mlp(data, field_data=field_data)
Methods
forward
(data, *[, field_data])forward function which overloads torch.nn.Module
from_setting
(setting)Generate model from setting object
Return neural network name
Attributes
T_destination
call_super_init
dump_patches
training
- forward(data, *, field_data=None, **kwards)[source]¶
forward function which overloads torch.nn.Module
- Parameters:
data (IPhlowerTensorCollections) – IPhlowerTensorCollections Data which receives from predecessors.
field_data (ISimulationField | None) – ISimulationField | None Constant information through training or prediction
- Returns:
Tensor object
- Return type: