import torch


def clipify(tensor, clip_len):
    """
    Divide tensor of video frames into clips
    Args:
        tensor: torch.Tensor(C, n_clip*clip_len, H, W)
        clip_len: int, number of frames for a single clip
        n_clip: int, number of clips to form
    Returns:
        torch.Tensor(n_clip, C, clip_len, H, W), sampled clips
    """
    split = torch.split(tensor, clip_len, dim=1)
    tensor = torch.stack(split)
    return tensor