import torch


def get_grid_points(num_rows, num_cols, dtype, device):
    """Returns grid points.

    Args:
        num_rows: int
        num_cols: int
        dtype
        device

    Returns:
        points: [num_rows * num_cols, 2]
    """
    xs = torch.linspace(0, 1, num_cols, dtype=dtype, device=device)
    ys = torch.linspace(0, 1, num_rows, dtype=dtype, device=device)
    xss, yss = torch.meshgrid(xs, ys)
    points = torch.stack([xss, yss], dim=-1).view(-1, 2)  # [num_points, 2]
    return points