import unittest
import torch


def require_cpu(test_case):
    """
    Decorator marking a test that must be only ran on the CPU. These tests are skipped when a GPU is available.
    """
    return unittest.skipUnless(not torch.cuda.is_available(), "test requires only a CPU")(test_case)