import torch
import torch.nn as nn

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

ALPHA_INIT = 1.0
BETA_INIT = 1.0

class RoSwish(nn.Module):
    '''
    RoSwish: A novel Rotating Swish activation function with adaptive rotation around zero
    https://www.sciencedirect.com/science/article/pii/S0893608025007737
    Formula: f(x) = (x + alpha) * sigmoid(beta * x) - 0.5 * alpha
    '''
    def __init__(self, alpha_init=1.0, beta_init=1.0):
        super(RoSwish, self).__init__()
        self.alpha = nn.Parameter(torch.tensor(alpha_init))
        self.beta = nn.Parameter(torch.tensor(beta_init))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        return (x + self.alpha) * torch.sigmoid(self.beta * x) - 0.5 * self.alpha

class Model(nn.Module):
    def __init__(self, alpha_init=1.0, beta_init=1.0):
        super(Model, self).__init__()
        self.act = RoSwish(alpha_init, beta_init)
    
    def forward(self, x):
        return self.act(x)

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

def get_init_inputs():
    return [ALPHA_INIT, BETA_INIT]