import torch
import torch.nn as nn
import torch.nn.functional as F

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

A_VALUE = 1.0
B_VALUE = 1.0

class SinLU(nn.Module):
    """
    SinLU Activation.
    "SinLU: Sinu-Sigmoidal Linear Unit" (Mathematics, 2022)
    https://www.mdpi.com/2227-7390/10/3/337
    Formula: f(x) = (x + a * sin(b * x)) * sigmoid(x)
    """
    def __init__(self, a=1.0, b=1.0):
        super(SinLU, self).__init__()
        self.a = a
        self.b = b

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        return (x + self.a * torch.sin(self.b * x)) * torch.sigmoid(x)

class Model(nn.Module):
    def __init__(self, a=1.0, b=1.0):
        super(Model, self).__init__()
        self.act = SinLU(a, b)
    
    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 [A_VALUE, B_VALUE]