Skip to content

Commit 9916ead

Browse files
committed
loss_data in pinn interface
1 parent 2e8d833 commit 9916ead

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

pina/solver/physics_informed_solver/pinn_interface.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,22 @@ def test_step(self, batch):
114114
"""
115115
return super().test_step(batch, loss_residuals=self._residual_loss)
116116

117+
def loss_data(self, input, target):
118+
"""
119+
Compute the data loss for the PINN solver by evaluating the loss
120+
between the network's output and the true solution. This method should
121+
be overridden by the derived class.
122+
:param LabelTensor input: The input to the neural network.
123+
:param LabelTensor target: The target to compare with the
124+
network's output.
125+
:return: The supervised loss, averaged over the number of observations.
126+
:rtype: LabelTensor
127+
"""
128+
raise NotImplementedError(
129+
"PINN is being used in a supervised learning context, but the "
130+
"'loss_data' method has not been implemented. "
131+
)
132+
117133
@abstractmethod
118134
def loss_phys(self, samples, equation):
119135
"""

0 commit comments

Comments
 (0)