artist.optim.regularizers ========================= .. py:module:: artist.optim.regularizers Classes ------- .. autoapisummary:: artist.optim.regularizers.Regularizer artist.optim.regularizers.SmoothnessRegularizer artist.optim.regularizers.IdealSurfaceRegularizer Module Contents --------------- .. py:class:: Regularizer(reduction_dimensions: tuple[int, Ellipsis]) Initialize the base regularizer. Parameters ---------- reduction_dimensions : tuple[int, ...] The dimensions along which to reduce the regularization term. .. py:attribute:: reduction_dimensions .. py:method:: __call__(current_control_points: torch.Tensor, original_control_points: torch.Tensor, device: torch.device | None = None, **kwargs: Any) -> torch.Tensor :abstractmethod: Compute the regularization. Parameters ---------- current_control_points : torch.Tensor The current control points. Shape is ``[number_of_heliostats, number_of_facets_per_surface, number_of_control_points_u_direction, number_of_control_points_v_direction, 3]``. original_control_points : torch.Tensor The current control points. Shape is ``[number_of_heliostats, number_of_facets_per_surface, number_of_control_points_u_direction, number_of_control_points_v_direction, 3]``. device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. \*\*kwargs : Any Keyword arguments. Raises ------ NotImplementedError This abstract method must be overridden. .. py:class:: SmoothnessRegularizer(reduction_dimensions: tuple[int, Ellipsis]) Bases: :py:obj:`Regularizer` Initialize the regularizer. Parameters ---------- reduction_dimensions : tuple[int, ...] Dimensions along which to reduce the loss. .. py:method:: __call__(current_control_points: torch.Tensor, original_control_points: torch.Tensor, device: torch.device | None = None, **kwargs: Any) -> torch.Tensor Compute the Laplacian regularization loss. The loss measures how much each control-point displacement differs from the average of its four immediate neighbors, thereby penalizing localized, non-smooth deformations. Parameters ---------- current_control_points : torch.Tensor The current control points. Shape is ``[number_of_heliostats, number_of_facets_per_surface, number_of_control_points_u_direction, number_of_control_points_v_direction, 3]``. original_control_points : torch.Tensor The original control points. Shape is ``[number_of_heliostats, number_of_facets_per_surface, number_of_control_points_u_direction, number_of_control_points_v_direction, 3]``. device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. Returns ------- torch.Tensor Laplacian regularization loss per surface. .. py:class:: IdealSurfaceRegularizer(reduction_dimensions: tuple[int, Ellipsis]) Bases: :py:obj:`Regularizer` Initialize the regularizer. Parameters ---------- reduction_dimensions : tuple[int, ...] Dimensions along which to reduce the loss. .. py:method:: __call__(current_control_points: torch.Tensor, original_control_points: torch.Tensor, device: torch.device | None = None, **kwargs: Any) -> torch.Tensor Compute the L2 loss between current control points and original control points. Parameters ---------- current_control_points : torch.Tensor The current control points. Shape is ``[number_of_heliostats, number_of_facets_per_surface, number_of_control_points_u_direction, number_of_control_points_v_direction, 3]``. original_control_points : torch.Tensor The current control points. Shape is ``[number_of_heliostats, number_of_facets_per_surface, number_of_control_points_u_direction, number_of_control_points_v_direction, 3]``. device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. Returns ------- torch.Tensor L2 deviation loss per surface.