File tree Expand file tree Collapse file tree
pina/solver/physics_informed_solver Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Module for the Physics-Informed Neural Network Interface."""
22
33from abc import ABCMeta , abstractmethod
4+ from typing import override
45import torch
56
67from ..supervised_solver import SupervisedSolverInterface
@@ -114,6 +115,22 @@ def test_step(self, batch):
114115 """
115116 return super ().test_step (batch , loss_residuals = self ._residual_loss )
116117
118+ def loss_data (self , input , target ):
119+ """
120+ Compute the data loss for the PINN solver by evaluating the loss
121+ between the network's output and the true solution. This method should
122+ be overridden by the derived class.
123+ :param LabelTensor input: The input to the neural network.
124+ :param LabelTensor target: The target to compare with the
125+ network's output.
126+ :return: The supervised loss, averaged over the number of observations.
127+ :rtype: LabelTensor
128+ """
129+ raise NotImplementedError (
130+ "PINN is being used in a supervised learning context, but the "
131+ "'loss_data' method has not been implemented. "
132+ )
133+
117134 @abstractmethod
118135 def loss_phys (self , samples , equation ):
119136 """
You can’t perform that action at this time.
0 commit comments