import torch


def apply_tform(tform, verts):
    """
    Applies a 4x4 rigid transform to a list of points
    :param tform: tensor (batch, 4, 4)
    :param verts: tensor (batch, N, 3)
    :return:
    """
    verts_homo = torch.cat((verts, torch.ones(verts.shape[0], verts.shape[1], 1, device=verts.device)), 2)
    new_verts = torch.bmm(tform, verts_homo.permute(0, 2, 1)).permute(0, 2, 1)
    return new_verts[:, :, :3]