import torch


def softmax(input):
    """
    Applies Softmax activation function.
    """
    output = torch.exp(input) / torch.exp(input).sum(1).view(-1,1)
    return torch.max(output, torch.empty(output.shape).fill_(1e-20))