import torch


def create_batch_from_data_list(data_list):
    """Given a list of datapoints, create a batch.

    Args:
        data_list (list): List of items returned by SceneRenderDataset.
    """
    imgs = []
    azimuths = []
    elevations = []
    for data_item in data_list:
        img, render_params = data_item["img"], data_item["render_params"]
        azimuth, elevation = render_params["azimuth"], render_params["elevation"]
        imgs.append(img.unsqueeze(0))
        azimuths.append(torch.Tensor([azimuth]))
        elevations.append(torch.Tensor([elevation]))
    imgs = torch.cat(imgs, dim=0)
    azimuths = torch.cat(azimuths)
    elevations = torch.cat(elevations)
    return imgs, azimuths, elevations