Source code for models.pinn.boundary_condition

from abc import ABC, abstractmethod

[docs] class BoundaryCondition(ABC): """ Abstract base class for defining boundary conditions. Args: points (Tensor): The points where the boundary condition is defined. Attributes: _points (Tensor): The points where the boundary condition is defined. """ def __init__(self, points): self._points = points self._points.requires_grad_(True)
[docs] @abstractmethod def loss(self, pred): """ Computes the loss for the given prediction. Args: pred (Tensor): The predicted values. Returns: Tensor: The loss value. """ pass
@property def points(self): return self._points