import torch
import torch.nn as nn

class Model(nn.Module):
    """PyTorch实现的SELU-Clip算子"""
    def __init__(self, alpha=1.6732632423543772, scale=1.0507009873554804, clip_min=-5.0, clip_max=5.0):
        super(Model, self).__init__()
        self.alpha = alpha
        self.scale = scale
        self.clip_min = clip_min
        self.clip_max = clip_max

    def forward(self, x):
        # 计算SELU
        selu_out = self.scale * torch.where(
            x > 0,
            x,
            self.alpha * (torch.exp(x) - 1)
        )
        # 裁剪操作
        clipped_out = torch.clamp(selu_out, self.clip_min, self.clip_max)
        return clipped_out

def get_init_inputs():
    """提供模型初始化参数"""
    return (1.6732632423543772, 1.0507009873554804, -5.0, 5.0)

def get_inputs():
    """提供测试输入数据"""
    torch.manual_seed(42)
    x = torch.randn(1024, 2048)  # 典型特征张量形状
    return (x,)