import torch
import torch.nn as nn

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

DTYPE = torch.float64

class ASU(nn.Module):
    """
    Amplifying Sine Unit: An Oscillatory Activation Function for Deep Neural Networks to Recover Nonlinear Oscillations Efficiently 
    https://arxiv.org/pdf/2304.09759
    Formula: f(x) = x * sin(x)
    """
    def __init__(self):
        super(ASU, self).__init__()

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

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

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

def get_init_inputs():
    return []