fastvpinns.model.model module

The file model.py hosts the Neural Network (NN) model and the training loop for variational Physics-Informed Neural Networks (PINNs). The focus is on the model architecture and the training loop, and not on the loss functions.

Author: Thivin Anandh D

Changelog: 22/Sep/2023 - Initial implementation with basic model architecture and training loop

Known issues: None

Dependencies: None specified

class fastvpinns.model.model.DenseModel(*args, **kwargs)[source]

Bases: Model

Defines the Dense Model for the Neural Network for solving Variational PINNs.

Parameters:
  • layer_dims (list) – List of dimensions of the dense layers.

  • learning_rate_dict (dict) – The dictionary containing the learning rate parameters.

  • params_dict (dict) – The dictionary containing the parameters.

  • loss_function (function) – The loss function for the PDE.

  • input_tensors_list (list) – The list containing the input tensors.

  • orig_factor_matrices (list) – The list containing the original factor matrices.

  • force_function_list (tf.Tensor) – The force function matrix.

  • tensor_dtype (tf.DType) – The tensorflow dtype to be used for all the tensors.

  • use_attention (bool, optional) – Flag to use attention layer after input, defaults to False.

  • activation (str, optional) – The activation function to be used for the dense layers, defaults to “tanh”.

  • hessian (bool, optional) – Flag to use hessian loss, defaults to False.

call(inputs)[source]

The call method for the model.

Parameters:

inputs (tf.Tensor) – The input tensor for the model.

Returns:

The output tensor of the model.

Return type:

tf.Tensor

get_config()[source]

Get the configuration of the model.

Returns:

The configuration of the model.

Return type:

dict

train_step(beta=10, bilinear_params_dict=None)[source]

The train step method for the model.

Parameters:
  • beta (int, optional) – The beta parameter for the training step, defaults to 10.

  • bilinear_params_dict (dict, optional) – The dictionary containing the bilinear parameters, defaults to None.

Returns:

The output of the training step.

Return type:

varies based on implementation