import torch
import torch.nn as nn

BATCH_SIZE = 4096
HIDDEN_DIM = 4096
SHAPE = (BATCH_SIZE, HIDDEN_DIM)

class GumbelPDF(nn.Module):
    """
    Gumbel Probability Density Function (PDF).
    f(x) = exp(-(x + exp(-x)))
    """
    def __init__(self, clamp_val=80.0):
        super(GumbelPDF, self).__init__()
        self.clamp_val = clamp_val

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        neg_x = torch.clamp(-x, max=self.clamp_val)
        inner_exp = torch.exp(neg_x)
        return torch.exp(-(x + inner_exp))

class Model(nn.Module):
    def __init__(self):
        super(Model, self).__init__()
        self.act = GumbelPDF()
    
    def forward(self, x):
        return self.act(x)

def get_inputs():
    input_tensor = torch.randn(SHAPE, dtype=torch.float32) * 20.0
    return [input_tensor.contiguous()]

def get_init_inputs():
    return []