import torch


def coordinates(x, y, start=-1, end=1):
    """
    Returns a map of coordinates with x rows and y columns.
    Input:
    - x: rows
    - y: columns
    Returns:
    - xy_coords: 1 x 2 x 'x' x y
    """
    x_row = torch.linspace(start, end, steps=y)  # y
    y_row = torch.linspace(start, end, steps=x)  # x
    x_coords = x_row.unsqueeze(0).expand(x, y).unsqueeze(0)  # 1 x y
    y_coords = y_row.unsqueeze(1).expand(x, y).unsqueeze(0)  # 1 x y
    # 1 2 x y
    return torch.autograd.Variable(torch.cat([x_coords, y_coords], 0).unsqueeze(0))