def _denormalize(locations, img_height, img_width):
    """helper function that converts locations from
    normalized co-ordinates"""
    for glimpse in range(locations.shape[0]):
        locations[(glimpse), :, (0)] = (locations[(glimpse), :, (0)] + 1
            ) / 2 * img_height
        locations[(glimpse), :, (1)] = (locations[(glimpse), :, (1)] + 1
            ) / 2 * img_width
    return locations
