import torch
import torch.nn as nn

class Model(nn.Module):
    def __init__(self, in_features):
        super().__init__()
        torch.manual_seed(42)
        self.linear = nn.Linear(in_features, in_features)

    def forward(self, x):
        x = self.linear(x)
        # 分段计算HardMish
        return torch.where(
            x <= -3,
            torch.zeros_like(x),
            torch.where(
                x >= 3,
                x,
                x * (x + 3) / 6
            )
        )

def get_inputs():
    batch_size = 8192
    in_features = 256
    x = torch.randn(batch_size, in_features)
    return [x]

def get_init_inputs():
    return [256]  