Skip to content

backend

torch.tvarant.backend()  str

Returns the active runtime name ("sim" or "opencl").

Return the active runtime name.

Returns:

Name Type Description
str str

"sim" for the CPU simulator, or "opencl" when built and

str

selected via TVARANT_BACKEND=opencl.

Examples:

>>> torch.tvarant.backend()
'sim'
Source code in torch_tvarant/tvarant/__init__.py
108
109
110
111
112
113
114
115
116
117
118
119
def backend() -> str:
    """Return the active runtime name.

    Returns:
        str: ``"sim"`` for the CPU simulator, or ``"opencl"`` when built and
        selected via ``TVARANT_BACKEND=opencl``.

    Examples:
        >>> torch.tvarant.backend()
        'sim'
    """
    return str(_C.backend())