INNER CODE UNIT · Python

register

DeepLabCut/DeepLabCut · deeplabcut/benchmark/__init__.py:27

def register(cls):
    """Add a benchmark to the list of evaluations to run.

    Apply this function as a decorator to a class. Note that the
    class needs to be a subclass of the ``benchmark.base.Benchmark``
    base class.

    In most situations, it will be a subclass of one of the pre-defined
    benchmarks in ``benchmark.benchmarks``.

    Throws:
        ``ValueError`` if the decorator is applied to a class that is
        not a subclass of ``benchmark.base.Benchmark``.
    """
    if not issubclass(cls, Benchmark):
        raise ValueError(f"Can only register subclasses of {type(Benchmark)}, but got {cls}.")
    __registry.append(cls)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…