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


class Model(nn.Module):
    def __init__(self, S=1, a_init=-0.2, b_init=0.4):
        super().__init__()
        self.S = S

        self.alpha = nn.Parameter(torch.full((S,), a_init, dtype=torch.float32))

        self.beta = nn.Parameter(torch.full((S,), b_init, dtype=torch.float32))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        output = F.relu(x)

        for s in range(self.S):
            output += self.alpha[s] * F.relu(-x + self.beta[s])

        return output


batch_size = 128
feature_dim = 512


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


def get_init_inputs():
    return [1, -0.2, 0.4]