fastvpinns.model.model_hard module

The file model_hard.py contains the DenseModel class which is a custom model for the Neural Network for solving Variational PINNs. This model is used for enforcing hard boundary constraints on the solution.

Author: Thivin Anandh D, Divij Ghose, Sashikumaar Ganesan

Date: 22/Jan/2024

Changelog: 22/Jan/2024 - file created

Known issues: None

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

Bases: Model

The DenseModel_Hard class is a custom model class that hosts the neural network model.

The class inherits from the tf.keras.Model class and is used to define the neural network model architecture and the training loop for FastVPINNs.

Parameters:
  • layer_dims (list) – List of integers representing the number of neurons in each layer

  • learning_rate_dict (dict) – Dictionary containing the learning rate parameters

  • params_dict (dict) – Dictionary containing the parameters for the model

  • loss_function (function) – Loss function for the model

  • input_tensors_list (list) – List of input tensors for the model

  • orig_factor_matrices (list) – List of original factor matrices

  • force_function_list (list) – List of force functions

  • tensor_dtype (tf.DType) – Tensor data type

  • use_attention (bool) – Flag to use attention layer

  • activation (str) – Activation function for the model

  • hessian (bool) – Flag to compute hessian

call(inputs)[source]

This method is used to define the forward pass of the model.

get_config()[source]

This method is used to get the configuration of the model.

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

This method is used to define the training step of the model.

call(inputs)[source]

This method is used to define the forward pass of the model.

Parameters:

inputs (tf.Tensor) – Input tensor

Returns:

Output tensor from the model

Return type:

tf.Tensor

get_config()[source]

This method is used to get the configuration of the model.

Returns:

Configuration of the model

Return type:

dict

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

This method is used to define the training step of the mode.

Parameters:

bilinear_params_dict (dict) – Dictionary containing the bilinear parameters

Returns:

Dictionary containing the loss values

Return type:

dict