import torch


def decode(loc, priors, variances):
    """
    :param loc: location predictions for loc layers, shape: [num_priors, 2]
    :param priors: center from, shape: [num_priors, 2]
    :param variances: list of variances
    :return: decoded segments, center form, shape: [num_priors, 2]
    """
    segments = torch.cat([
        priors[:, :1] + loc[:, :1] * priors[:, 1:] * variances[0],
        priors[:, 1:] * torch.exp(loc[:, 1:] * variances[1])], dim=1)
    return segments