import torch


def get_xy(dls):
    """Grabs data as tensors from a DataLoaders instance."""
    x, y = [], []
    for batch in dls.train:
        x.append(torch.cat(list(batch)[:-1], dim=-1) if len(batch) > 2 else batch[0])
        y.append(batch[-1])
    return torch.cat(x, dim=0), torch.cat(y, dim=0)