utils.py 236 Bytes
Newer Older
quyuanhao123's avatar
quyuanhao123 committed
1
2
3
4
5
6
7
8
9
10
from typing import Any

try:
    from typing_extensions import Final  # noqa
except ImportError:
    from torch.jit import Final  # noqa


def is_scalar(other: Any) -> bool:
    return isinstance(other, int) or isinstance(other, float)