siml.networks package¶
Subpackages¶
Submodules¶
siml.networks.abstract_equivariant_gnn module¶
- class siml.networks.abstract_equivariant_gnn.AbstractEquivariantGNN(block_setting)¶
Bases:
AbstractGCN
Abstract class for equivariant GNN.
- training: bool¶
siml.networks.abstract_gcn module¶
- class siml.networks.abstract_gcn.AbstractGCN(block_setting, *, create_subchain=True, residual=False, multiple_networks=None)¶
Bases:
SimlModule
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.activation module¶
- class siml.networks.activation.Activation(block_setting)¶
Bases:
SimlModule
Activation block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.activations module¶
- class siml.networks.activations.ATanh(epsilon)¶
Bases:
Module
- forward(x)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool¶
- class siml.networks.activations.DerivativeLeakyReLU(original_lrelu=None)¶
Bases:
Module
- forward(x)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool¶
- class siml.networks.activations.InversedLeakyReLU(original_lrelu=None)¶
Bases:
Module
- forward(x)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool¶
- siml.networks.activations.atanh(x, epsilon=1e-05)¶
- siml.networks.activations.derivative_smooth_leaky_relu(x)¶
- siml.networks.activations.derivative_tanh(x)¶
- siml.networks.activations.identity(x)¶
- siml.networks.activations.inversed_smooth_leaky_relu(x)¶
- siml.networks.activations.max_pool(x, original_shapes)¶
- siml.networks.activations.mean(x, original_shapes)¶
- siml.networks.activations.min(x, original_shapes)¶
- siml.networks.activations.min_func(*args, **kwargs)¶
- siml.networks.activations.mish(x)¶
- siml.networks.activations.normalize(x)¶
- siml.networks.activations.one(x)¶
- siml.networks.activations.smooth_leaky_relu(x)¶
- siml.networks.activations.split(x, original_shapes)¶
siml.networks.array2diagmat module¶
- class siml.networks.array2diagmat.Array2Diagmat(block_setting)¶
Bases:
SimlModule
Convert array to diagonal matrix. [n, f] -> [n, 3, 3, f]
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.array2symmat module¶
- class siml.networks.array2symmat.Array2Symmat(block_setting)¶
Bases:
SimlModule
Convert array to symmetric matrix.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.boundary module¶
- class siml.networks.boundary.Assignment(block_setting)¶
Bases:
SimlModule
Assignment layer.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.boundary.Dirichlet(block_setting)¶
Bases:
SimlModule
Dirichlet boundary condition management.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.boundary.Interaction(block_setting)¶
Bases:
SimlModule
Interaction layer.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.boundary.NeumannDecoder(block_setting, reference_block)¶
Bases:
SimlModule
Decoder for gradient with Neumann condition.
- SUPPORTED_ACTIVATION_NAMES = ['identity', 'leaky_relu']¶
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- validate()¶
- class siml.networks.boundary.NeumannEncoder(block_setting, reference_block)¶
Bases:
SimlModule
Encoder for Neumann condition.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- property activations¶
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- property linears¶
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- property weights¶
- class siml.networks.boundary.NeumannIsoGCN(block_setting, reference_block)¶
Bases:
SimlModule
Neumann boundary condition management using IsoGCN.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.concatenator module¶
- class siml.networks.concatenator.Concatenator(block_setting)¶
Bases:
SimlModule
Concatenation operation block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.cross_product module¶
- class siml.networks.cross_product.CrossProduct(block_setting)¶
Bases:
SimlModule
Cross Product block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.deepsets module¶
- class siml.networks.deepsets.DeepSets(block_setting)¶
Bases:
SimlModule
Permutation equivalent layer published in https://arxiv.org/abs/1703.06114 .
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.einops module¶
- class siml.networks.einops.Rearrange(block_setting)¶
Bases:
SimlModule
Apply einops.rearrange.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.einsum module¶
- class siml.networks.einsum.EinSum(block_setting)¶
Bases:
SimlModule
EinSum block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.gcn module¶
- class siml.networks.gcn.GCN(block_setting)¶
Bases:
AbstractGCN
Graph Convolutional network based on https://arxiv.org/abs/1609.02907 .
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- training: bool¶
siml.networks.group module¶
- class siml.networks.group.Group(block_setting, model_setting)¶
Bases:
SimlModule
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- broadcast(a, x, operator)¶
- calculate_residual(x, ref)¶
- static create_group_setting(block_setting, model_setting)¶
- forward_implicit(*args: Any, **kwargs: Any) Any ¶
- forward_time_series(*args: Any, **kwargs: Any) Any ¶
- forward_w_loop(*args: Any, **kwargs: Any) Any ¶
- forward_wo_loop(*args: Any, **kwargs: Any) Any ¶
- generate_inputs(dict_predecessors)¶
- generate_outputs(y)¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- property input_names¶
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- operate(x, y, operator)¶
- property output_names¶
- static sum_dim_if_needed(dim)¶
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.id_mlp module¶
- class siml.networks.id_mlp.IdMLP(block_setting, *, create_linears=True, create_activations=True, create_dropouts=True, no_parameter=False, residual_dimension=None, **kwargs)¶
Bases:
SimlModule
Multi Layer Perceptron with adding the identity.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.identity module¶
- class siml.networks.identity.Identity(block_setting)¶
Bases:
SimlModule
Identity block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.implicit_gnn module¶
Implicit GNN
Original Implementation is found here: https://github.com/SwiftieH/IGNN
Overview * Fangda Gu, Heng Chang, Wenwu Zhu, Somayeh Sojoudi, Laurent El Ghaoui * 34th Conference on Neural Information Processing Systems (NeurIPS 2020), Vancouver, Canada. * arxiv: https://arxiv.org/abs/2009.06211
- class siml.networks.implicit_gnn.IGNNIterationStatus(value)¶
Bases:
Enum
An enumeration.
- converged = 1¶
- not_started = 0¶
- reached_max_itration = 2¶
- class siml.networks.implicit_gnn.ImplicitFunction(*args, **kwargs)¶
Bases:
Function
- static backward(ctx, *grad_outputs)¶
Defines a formula for differentiating the operation with backward mode automatic differentiation.
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward()
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward()
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward()
will havectx.needs_input_grad[0] = True
if the first input toforward()
needs gradient computated w.r.t. the output.
- static forward(ctx: Any, W: Tensor, X_0: Tensor, A: Tensor, B: Tensor, phi: Callable[[Tensor], Tensor], fd_mitr: int = 300, bw_mitr: int = 300)¶
Performs the operation.
This function is to be overridden by all subclasses.
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
The context can be used to store arbitrary data that can be then retrieved during the backward pass.
- class siml.networks.implicit_gnn.ImplicitGNN(block_setting: BlockSetting)¶
Bases:
SimlModule
A Implicit Graph Neural Network Layer (IGNN)
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- siml.networks.implicit_gnn.calculate_spectral_rad(sparse_tensor: Tensor) ndarray ¶
Compute spectral radius from a tensor
- Parameters:
sparse_tensor (torch.Tensor) – tensor to calculate
- Returns:
spectral radius
- Return type:
np.ndarray
- siml.networks.implicit_gnn.projection_norm_inf(A: Tensor, criteria: float = 0.99) None ¶
Project onto ||A||_inf <= criteria return updated A
- Parameters:
A (torch.Tensor) – Tensor object
criteria (float, optional) – criteria value, by default 0.99
siml.networks.integration module¶
- class siml.networks.integration.Integration(block_setting)¶
Bases:
SimlModule
Integration block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.iso_gcn module¶
- class siml.networks.iso_gcn.IsoGCN(block_setting)¶
Bases:
AbstractEquivariantGNN
IsoGCN according to https://arxiv.org/abs/2005.06316 .
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- training: bool¶
siml.networks.lstm module¶
- class siml.networks.lstm.LSTM(block_setting)¶
Bases:
SimlModule
LSTM layer.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.message_passing module¶
- class siml.networks.message_passing.MessagePassing(block_setting)¶
Bases:
AbstractGCN
Message passing layer based on https://arxiv.org/abs/1704.01212.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- make_reduce_matrix(nadj, *, mean=False)¶
- training: bool¶
siml.networks.mlp module¶
- class siml.networks.mlp.MLP(block_setting, **kwargs)¶
Bases:
SimlModule
Multi Layer Perceptron.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.nan_mlp module¶
- class siml.networks.nan_mlp.NaNMLP(block_setting, **kwargs)¶
Bases:
MLP
Multi Layer Perceptron with NaN handling.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.network module¶
- class siml.networks.network.Network(model_setting, trainer_setting)¶
Bases:
Module
- clip_if_needed()¶
- clip_uniform_if_needed(clip_grad_value: float, clip_grad_norm: float) None ¶
- dict_block_class = {'accessor': <class 'siml.networks.reshape.Accessor'>, 'activation': <class 'siml.networks.activation.Activation'>, 'adjustable_mlp': <class 'siml.networks.mlp.MLP'>, 'array2diagmat': <class 'siml.networks.array2diagmat.Array2Diagmat'>, 'array2symmat': <class 'siml.networks.array2symmat.Array2Symmat'>, 'assignment': <class 'siml.networks.boundary.Assignment'>, 'cluster_gcn': <class 'siml.networks.pyg.cluster_gcn.ClusterGCN'>, 'concatenator': <class 'siml.networks.concatenator.Concatenator'>, 'contraction': <class 'siml.networks.tensor_operations.Contraction'>, 'cross_product': <class 'siml.networks.cross_product.CrossProduct'>, 'deepsets': <class 'siml.networks.deepsets.DeepSets'>, 'dirichlet': <class 'siml.networks.boundary.Dirichlet'>, 'distributor': <class 'siml.networks.reducer.Reducer'>, 'einsum': <class 'siml.networks.einsum.EinSum'>, 'equivariant_mlp': <class 'siml.networks.tensor_operations.EquivariantMLP'>, 'equivariant_tcn': <class 'siml.networks.tcn.EquivariantTCN'>, 'features_to_time_series': <class 'siml.networks.reshape.FeaturesToTimeSeries'>, 'gcn': <class 'siml.networks.gcn.GCN'>, 'gcnii': <class 'siml.networks.pyg.gcnii.GCNII'>, 'gin': <class 'siml.networks.pyg.gin.GIN'>, 'group': <class 'siml.networks.group.Group'>, 'id_mlp': <class 'siml.networks.id_mlp.IdMLP'>, 'identity': <class 'siml.networks.identity.Identity'>, 'implicit_gnn': <class 'siml.networks.implicit_gnn.ImplicitGNN'>, 'integration': <class 'siml.networks.integration.Integration'>, 'interaction': <class 'siml.networks.boundary.Interaction'>, 'iso_gcn': <class 'siml.networks.iso_gcn.IsoGCN'>, 'lstm': <class 'siml.networks.lstm.LSTM'>, 'message_passing': <class 'siml.networks.message_passing.MessagePassing'>, 'mlp': <class 'siml.networks.mlp.MLP'>, 'nan_mlp': <class 'siml.networks.nan_mlp.NaNMLP'>, 'neumann_decoder': <class 'siml.networks.boundary.NeumannDecoder'>, 'neumann_encoder': <class 'siml.networks.boundary.NeumannEncoder'>, 'neumann_isogcn': <class 'siml.networks.boundary.NeumannIsoGCN'>, 'normalized_mlp': <class 'siml.networks.normalized_mlp.NormalizedMLP'>, 'penn': <class 'siml.networks.penn.PENN'>, 'pinv_mlp': <class 'siml.networks.pinv_mlp.PInvMLP'>, 'projection': <class 'siml.networks.projection.Projection'>, 'proportional': <class 'siml.networks.proportional.Proportional'>, 'rearrange': <class 'siml.networks.einops.Rearrange'>, 'reducer': <class 'siml.networks.reducer.Reducer'>, 'reshape': <class 'siml.networks.reshape.Reshape'>, 'set_transformer_decoder': <class 'siml.networks.set_transformer.SetTransformerDecoder'>, 'set_transformer_encoder': <class 'siml.networks.set_transformer.SetTransformerEncoder'>, 'share': <class 'siml.networks.share.Share'>, 'spmm': <class 'siml.networks.spmm.SpMM'>, 'symmat2array': <class 'siml.networks.symmat2array.Symmat2Array'>, 'tcn': <class 'siml.networks.tcn.TCN'>, 'tensor_product': <class 'siml.networks.tensor_operations.TensorProduct'>, 'threshold': <class 'siml.networks.threshold.Threshold'>, 'time_norm': <class 'siml.networks.time_norm.TimeNorm'>, 'time_series_to_features': <class 'siml.networks.reshape.TimeSeriesToFeatures'>, 'translator': <class 'siml.networks.translator.Translator'>, 'upper_limit': <class 'siml.networks.upper_limit.UpperLimit'>}¶
- draw(output_directory, *, stem=None)¶
- forward(x_: dict)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- get_loss_coeffs()¶
- get_loss_keys()¶
- get_losses()¶
- reset()¶
- training: bool¶
- siml.networks.network.add_block(block)¶
Add block definition to siml.
- Parameters:
block (siml.network.SimlModule-like) – User defined block.
siml.networks.normalized_mlp module¶
- class siml.networks.normalized_mlp.NormalizedMLP(block_setting, *, create_linears=True, create_activations=True, create_dropouts=True, no_parameter=False, residual_dimension=None, **kwargs)¶
Bases:
SimlModule
Multi Layer Perceptron with the normalized weight.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.penn module¶
- class siml.networks.penn.PENN(block_setting)¶
Bases:
AbstractEquivariantGNN
Physics-Embedded Neural Network.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- training: bool¶
siml.networks.pinv_mlp module¶
- class siml.networks.pinv_mlp.PInvLinear(ref_linear, option)¶
Bases:
Module
- property bias¶
Return inverse bias.
- forward(x)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool¶
- property weight¶
Return pseudo inversed weight.
- class siml.networks.pinv_mlp.PInvMLP(block_setting, reference_block)¶
Bases:
SimlModule
Pseudo inverse of Multi Layer Perceptron.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.projection module¶
- class siml.networks.projection.Projection(block_setting)¶
Bases:
SimlModule
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*xs, supports=None, original_shapes=None) Tensor ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.proportional module¶
- class siml.networks.proportional.Proportional(block_setting)¶
Bases:
SimlModule
Proportional layer.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.reducer module¶
- class siml.networks.reducer.Reducer(block_setting)¶
Bases:
SimlModule
Broadcastive operation block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.reshape module¶
- class siml.networks.reshape.Accessor(block_setting)¶
Bases:
SimlModule
Access data using the given index.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.reshape.FeaturesToTimeSeries(block_setting)¶
Bases:
SimlModule
Convert feature axes to time series.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.reshape.Reshape(block_setting)¶
Bases:
SimlModule
Reshape block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.reshape.TimeSeriesToFeatures(block_setting)¶
Bases:
SimlModule
Convert time series axes to features.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.set_transformer module¶
Set Transformer implementation based on https://arxiv.org/abs/1810.00825 and the official implementation https://github.com/juho-lee/set_transformer .
- class siml.networks.set_transformer.ISAB(dim_in, dim_out, num_heads, layer_norm, activation, n_inducing_point=None)¶
Bases:
Module
ISAB: the Induced Set Attention Block. It maps [n, d_in] -> [n, d_out], with inducing points, therefore it takes O(n n_induce), where n_induce is the number of the inducing points.
- forward(X)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool¶
- class siml.networks.set_transformer.MAB(dim_Q, dim_K, dim_V, num_heads, activation, layer_norm)¶
Bases:
Module
MAB: the Multihead Attention Block. It maps [n, d_in] x [n, d_in] -> [n, d_out].
- forward(Q, K)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool¶
- class siml.networks.set_transformer.PMA(dim, num_heads, num_seeds, activation, layer_norm)¶
Bases:
Module
PMA: Pooling by Multihead Attention. It maps [n, d_in] -> [k, d_out], where k is the number of the output vectors.
- forward(X)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool¶
- class siml.networks.set_transformer.SAB(dim_in, dim_out, num_heads, layer_norm, activation, n_inducing_point=None)¶
Bases:
Module
SAB: the Set Attention Block. It maps [n, d_in] -> [n, d_out], without inducing points, therefore it takes O(n^2).
- forward(X)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool¶
- class siml.networks.set_transformer.SetTransformerDecoder(block_setting)¶
Bases:
SimlModule
Set Transformer’s encoder based on https://arxiv.org/abs/1810.00825 .
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.set_transformer.SetTransformerEncoder(block_setting)¶
Bases:
SimlModule
Set Transformer’s encoder based on https://arxiv.org/abs/1810.00825 .
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.siml_module module¶
- class siml.networks.siml_module.SimlModule(block_setting, *, create_linears=True, create_activations=True, create_dropouts=True, no_parameter=False, residual_dimension=None, **kwargs)¶
Bases:
Module
- abstract static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- create_activation(activation_settings=None)¶
- create_activations(activation_settings=None, residual=None)¶
- create_dropout_ratios(dropouts=None)¶
- create_linears(nodes=None, bias=None)¶
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- classmethod get_n_nodes(block_setting, predecessors, dict_block_setting, input_length, output_length, model_setting)¶
Get the number of input and output nodes.
- Parameters:
block_setting (siml.setting.BlockSetting) – BlockSetting object of the block.
predecessors (tuple[str]) – List of predecessor names.
dict_block_setting (dict[siml.setting.BlockSetting]) – Dict of all BlockSetting objects.
input_length (int or dict[int]) – Input length.
output_length (int or dict[int]) – Output length.
model_setting (siml.setting.ModelSetting) – ModelSetting object.
- Returns:
input_node (int) – The number of the input nodes.
output_node (int) – The number of the output nodes.
- abstract static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- abstract static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- reset()¶
- training: bool¶
- abstract static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.sparse module¶
- siml.networks.sparse.mul(sparse: Tensor, tensor)¶
Multiply sparse tensors and tensors.
- Parameters:
sparses (torch.sparse_coo_tensor) –
tensor (torch.Tensor) –
- Return type:
torch.Tensor
siml.networks.spmm module¶
- class siml.networks.spmm.SpMM(block_setting)¶
Bases:
AbstractGCN
Layer to compute sparse matrix times dence matrix.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.symmat2array module¶
- class siml.networks.symmat2array.Symmat2Array(block_setting)¶
Bases:
SimlModule
Convert symmetric matrix to array.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.tcn module¶
- class siml.networks.tcn.EquivariantTCN(block_setting)¶
Bases:
SimlModule
E(n)-equivariant TCN layer.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.tcn.TCN(block_setting)¶
Bases:
SimlModule
Temporal Convolutional Networks (TCN) https://arxiv.org/abs/1803.01271 .
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.tensor_operations module¶
- class siml.networks.tensor_operations.Contraction(block_setting)¶
Bases:
SimlModule
Contraction block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.tensor_operations.EquivariantMLP(block_setting)¶
Bases:
SimlModule
E(n) equivariant MLP block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
- class siml.networks.tensor_operations.TensorProduct(block_setting)¶
Bases:
SimlModule
Tensor product block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.threshold module¶
- class siml.networks.threshold.Threshold(block_setting)¶
Bases:
SimlModule
- DEFALUT_THRESHOLD = 0.0¶
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.time_norm module¶
- class siml.networks.time_norm.TimeNorm(block_setting)¶
Bases:
SimlModule
Normalization for time series data which makes x[t=0, …] = 0.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.translator module¶
- class siml.networks.translator.Translator(block_setting)¶
Bases:
SimlModule
Translation block.
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).
siml.networks.upper_limit module¶
- class siml.networks.upper_limit.UpperLimit(block_setting)¶
Bases:
SimlModule
- static accepts_multiple_inputs()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it accepts multiple inputs.
- block_setting: BlockSetting¶
- forward(*args: Any, **kwargs: Any) Any ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- static get_name()¶
Abstract method to be overridden by the subclass. It shoud return str indicating its name.
- static is_trainable()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it is trainable.
- training: bool¶
- static uses_support()¶
Abstract method to be overridden by the subclass. It shoud return bool indicating if it uses support inputs (sparse matrices).