import torch


def Conv2dGroup(
    in_channels: int,
    out_channels: int,
    kernel_size: int = 3,
    stride: int = 1,
    padding: int = 0,
    bias: bool = True,
    num_groups=1,
    **kwargs,
):
    """A 2D convolution followed by a group norm and ReLU activation."""
    return torch.nn.Sequential(
        torch.nn.Conv2d(
            in_channels=in_channels,
            out_channels=out_channels,
            kernel_size=kernel_size,
            stride=stride,
            padding=padding,
            bias=bias,
        ),
        torch.nn.GroupNorm(num_groups, out_channels),
        torch.nn.ReLU(inplace=True),
    )