ISubGVQA.sampling.methods.target_aimle ====================================== .. py:module:: ISubGVQA.sampling.methods.target_aimle Attributes ---------- .. autoapisummary:: ISubGVQA.sampling.methods.target_aimle.logger Classes ------- .. autoapisummary:: ISubGVQA.sampling.methods.target_aimle.BaseTargetDistribution ISubGVQA.sampling.methods.target_aimle.TargetDistribution ISubGVQA.sampling.methods.target_aimle.AdaptiveTargetDistribution Module Contents --------------- .. py:data:: logger .. py:class:: BaseTargetDistribution Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:method:: params(theta: torch.Tensor, dy: Optional[torch.Tensor], _is_minimization: bool = False) -> torch.Tensor :abstractmethod: .. py:method:: process(theta: torch.Tensor, dy: torch.Tensor, gradient: torch.Tensor) -> torch.Tensor :abstractmethod: .. py:class:: TargetDistribution(alpha: float = 1.0, beta: float = 1.0, do_gradient_scaling: bool = False, eps: float = 1e-07) Bases: :py:obj:`BaseTargetDistribution` Creates a generator of target distributions parameterized by :attr:`alpha` and :attr:`beta`. Example:: >>> import torch >>> target_distribution = TargetDistribution(alpha=1.0, beta=1.0) >>> target_distribution.params(theta=torch.tensor([1.0]), dy=torch.tensor([1.0])) tensor([2.]) Args: alpha (float): weight of the initial distribution parameters theta beta (float): weight of the downstream gradient dy do_gradient_scaling (bool): whether to scale the gradient by 1/λ or not .. py:attribute:: alpha :value: 1.0 .. py:attribute:: beta :value: 1.0 .. py:attribute:: do_gradient_scaling :value: False .. py:attribute:: eps :value: 1e-07 .. py:method:: params(theta: torch.Tensor, dy: Optional[torch.Tensor], alpha: Optional[float] = None, beta: Optional[float] = None, _is_minimization: bool = False) -> torch.Tensor .. py:method:: process(theta: torch.Tensor, dy: torch.Tensor, gradient_3d: torch.Tensor) -> torch.Tensor .. py:class:: AdaptiveTargetDistribution(initial_alpha: float = 1.0, initial_beta: float = 1.0, initial_grad_norm: float = 1.0, beta_update_step: float = 0.0001, beta_update_momentum: float = 0.0, grad_norm_decay_rate: float = 0.9, target_norm: float = 1.0) Bases: :py:obj:`BaseTargetDistribution` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: alpha :value: 1.0 .. py:attribute:: beta :value: 1.0 .. py:attribute:: grad_norm :value: 1.0 .. py:attribute:: beta_update_step :value: 0.0001 .. py:attribute:: beta_update_momentum :value: 0.0 .. py:attribute:: previous_beta_update :value: 0.0 .. py:attribute:: grad_norm_decay_rate :value: 0.9 .. py:attribute:: target_norm :value: 1.0 .. py:method:: _perturbation_magnitude(theta: torch.Tensor, dy: Optional[torch.Tensor]) .. py:method:: params(theta: torch.Tensor, dy: Optional[torch.Tensor], _is_minimization: bool = False) -> torch.Tensor .. py:method:: process(theta: torch.Tensor, dy: torch.Tensor, gradient_3d: torch.Tensor) -> torch.Tensor