MIONet#
- class MIONet(networks, aggregator='*', reduction='+', scale=True, translation=True)[source]#
Bases:
Module
The PINA implementation of MIONet network.
MIONet is a general architecture for learning Operators defined on the tensor product of Banach spaces. Unlike traditional machine learning methods MIONet is designed to map entire functions to other functions. It can be trained both with Physics Informed or Supervised learning strategies.
See also
Original reference: Jin, Pengzhan, Shuai Meng, and Lu Lu. MIONet: Learning multiple-input operators via tensor product. SIAM Journal on Scientific Computing 44.6 (2022): A3490-A351 DOI: 10.1137/22M1477751
- Parameters:
networks (dict) – The neural networks to use as models. The
dict
takes as key a neural network, and as value the list of indeces to extract from the input variable in the forward pass of the neural network. If a list ofint
is passed, the corresponding columns of the inner most entries are extracted. If a list ofstr
is passed the variables of the correspondingpina.label_tensor.LabelTensor
are extracted. Thetorch.nn.Module
model has to take as input apina.label_tensor.LabelTensor
ortorch.Tensor
. Default implementation consist of different branch nets and one trunk nets.aggregator (str or Callable) – Aggregator to be used to aggregate partial results from the modules in nets. Partial results are aggregated component-wise. Available aggregators include sum:
+
, product:*
, mean:mean
, min:min
, max:max
.reduction (str or Callable) – Reduction to be used to reduce the aggregated result of the modules in nets to the desired output dimension. Available reductions include sum:
+
, product:*
, mean:mean
, min:min
, max:max
.scale (bool or Callable) – Scaling the final output before returning the forward pass, default
True
.translation (bool or Callable) – Translating the final output before returning the forward pass, default
True
.
Warning
In the forward pass we do not check if the input is instance of
pina.label_tensor.LabelTensor
ortorch.Tensor
. A general rule is that for apina.label_tensor.LabelTensor
input both list of integers and list of strings can be passed forinput_indeces_branch_net
andinput_indeces_trunk_net
. Differently, for atorch.Tensor
only a list of integers can be passed forinput_indeces_branch_net
andinput_indeces_trunk_net
.- Example:
>>> branch_net1 = FeedForward(input_dimensons=1, output_dimensions=10) >>> branch_net2 = FeedForward(input_dimensons=2, output_dimensions=10) >>> trunk_net = FeedForward(input_dimensons=1, output_dimensions=10) >>> networks = {branch_net1 : ['x'], branch_net2 : ['x', 'y'], ... trunk_net : ['z']} >>> model = MIONet(networks=networks, ... reduction='+', ... aggregator='*') >>> model MIONet( (models): ModuleList( (0): FeedForward( (model): Sequential( (0): Linear(in_features=1, out_features=20, bias=True) (1): Tanh() (2): Linear(in_features=20, out_features=20, bias=True) (3): Tanh() (4): Linear(in_features=20, out_features=10, bias=True) ) ) (1): FeedForward( (model): Sequential( (0): Linear(in_features=2, out_features=20, bias=True) (1): Tanh() (2): Linear(in_features=20, out_features=20, bias=True) (3): Tanh() (4): Linear(in_features=20, out_features=10, bias=True) ) ) (2): FeedForward( (model): Sequential( (0): Linear(in_features=1, out_features=20, bias=True) (1): Tanh() (2): Linear(in_features=20, out_features=20, bias=True) (3): Tanh() (4): Linear(in_features=20, out_features=10, bias=True) ) ) ) )
- forward(x)[source]#
Defines the computation performed at every call.
- Parameters:
x (LabelTensor or torch.Tensor) – The input tensor for the forward call.
- Returns:
The output computed by the DeepONet model.
- Return type:
- property aggregator#
The aggregator function.
- property reduction#
The translation factor.
- property scale#
The scale factor.
- property translation#
The translation factor for MIONet.
- property indeces_variables_extracted#
The input indeces for each model in form of list.
- property model#
The models in form of list.