import torch


def is_activation_to_checkpoint(item, world_size):
    """
    Check is activation to checkpoint or not

    Args:
        item (Any): any object
        world_size (int): model parallel world size

    Returns:
        bool: is activation to checkpoint or not
    """
    return (
        torch.is_tensor(item)
        and item.is_floating_point()
        and item.numel() >= world_size
        and item.requires_grad
    )