fastvpinns.model.model_inverse module

The file model_inverse.py hosts the Neural Network (NN) model and the training loop for variational Physics-Informed Neural Networks (PINNs). This focuses on training variational PINNs for inverse problems where the inverse parameter is constant on the domain. 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: Currently out of the box, supports only one constant inverse parameters.

Dependencies: None specified

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

Bases: Model

A subclass of tf.keras.Model that defines a dense model for an inverse problem.

Parameters:
  • layer_dims (list) – The dimensions of the layers in the model.

  • learning_rate_dict (dict) – A dictionary containing the learning rates.

  • params_dict (dict) – A dictionary containing the parameters of the model.

  • loss_function (function) – The loss function to be used in the model.

  • input_tensors_list (list) – A list of input tensors.

  • orig_factor_matrices (list) – The original factor matrices.

  • force_function_list (list) – A list of force functions.

  • sensor_list (list) – A list of sensors for the inverse problem.

  • inverse_params_dict (dict) – A dictionary containing the parameters for the inverse problem.

  • tensor_dtype (tf.DType) – The data type of the tensors.

  • use_attention (bool) – Whether to use attention mechanism in the model. Defaults to False.

  • activation (str) – The activation function to be used in the model. Defaults to ‘tanh’.

  • hessian (bool) – Whether to use Hessian in the model. Defaults to False.

call(inputs)[source]

Applies the model to the input data.

Parameters:

inputs – The input data.

Returns:

The output of the model after applying all the layers.

get_config()[source]

Returns the configuration of the model.

This method is used to serialize the model configuration. It returns a dictionary containing all the necessary information to recreate the model.

Returns:

The configuration dictionary of the model.

Return type:

dict

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