import torch


def exponential_transition(perturbations, norm, epsilon=0.3, gamma=1):
    """
    Exponential transition rule.

    :param perturbations: perturbations
    :type perturbations: torch.autograd.Variable
    :param norm: norm
    :type norm: attacks.norms.Norm
    :param epsilon: epsilon
    :type epsilon: float
    :param gamma: gamma
    :type gamma: float
    :return: gamma, norms
    :rtype: torch.autograd.Variable, torch.autograd.Variable
    """

    norms = norm(perturbations)
    return 1 - torch.exp(-gamma * norms), norms