Skip to content

device_count

torch.tvarant.device_count()  int

Returns the number of logical Tvarant devices.

Return the number of logical Tvarant devices.

Returns:

Name Type Description
int int

Device count (currently 1 for both sim and OpenCL backends).

Examples:

>>> torch.tvarant.device_count()
1
Source code in torch_tvarant/tvarant/__init__.py
63
64
65
66
67
68
69
70
71
72
73
def device_count() -> int:
    """Return the number of logical Tvarant devices.

    Returns:
        int: Device count (currently ``1`` for both sim and OpenCL backends).

    Examples:
        >>> torch.tvarant.device_count()
        1
    """
    return int(_C.device_count())