import torch
import torch.nn as nn

BATCH_SIZE = 4096
DIM = 4096
SHAPE = (BATCH_SIZE, DIM)

class TanhExp(nn.Module):
    """
    公式: f(x) = x * tanh(e^x)
    """
    def __init__(self):
        super(TanhExp, self).__init__()

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        return x * torch.tanh(torch.exp(x))

class Model(nn.Module):
    def __init__(self):
        super(Model, self).__init__()
        self.act = TanhExp()
    
    def forward(self, x: torch.Tensor) -> torch.Tensor:
        return self.act(x)

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

def get_init_inputs():
    return []