import torch


def gamma_pdf(alpha, beta, x):
    """
    PDF for a Gamma(alpha, beta) distributed RV.
    """
    return torch.pow(beta, alpha) / torch.exp(torch.lgamma(alpha)) \
        * torch.pow(x, alpha - 1) * torch.exp(-beta * x)