import torch
import torch.nn as nn

class Model(nn.Module):
    def __init__(self, proto: torch.Tensor, alpha: float, beta: float):
        super(Model, self).__init__()
        self.proto = nn.Parameter(proto)
        self.alpha = nn.Parameter(torch.tensor(float(alpha), dtype=torch.float32))
        self.beta = nn.Parameter(torch.tensor(float(beta), dtype=torch.float32))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        dot = torch.sum(x * self.proto.view(1,-1), dim=1, keepdim=True)
        nx = torch.sqrt(torch.sum(x * x, dim=1, keepdim=True) + 1e-8)
        np = torch.sqrt(torch.sum(self.proto * self.proto) + 1e-8)
        cosv = dot / (nx * np)
        g = torch.sigmoid(self.alpha * cosv + self.beta)
        return x * g

batch_size = 32
dim = 8192

def get_inputs():
    x = torch.randn(batch_size, dim)
    return [x]

def get_init_inputs():
    proto = torch.randn(dim)
    alpha = 1.0
    beta = 0.0
    return [proto, alpha, beta]
