# groupnorm_torch.py
import torch
import torch.nn as nn

N, C, H, W = 64, 256, 56, 56
NUM_GROUPS = 32
EPS = 1e-5

class Model(nn.Module):
    """使用 PyTorch 内置 nn.GroupNorm 的基准实现。"""
    def __init__(self, num_groups, num_channels, eps):
        super().__init__()
        self.groupnorm = nn.GroupNorm(num_groups, num_channels, eps=eps, affine=True)

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

def get_inputs():
    x = torch.randn(N, C, H, W, dtype=torch.float32)
    return [x]

def get_init_inputs():
    return [NUM_GROUPS, C, EPS]