2021-11-03 00:21:40 +08:00
|
|
|
try:
|
2021-11-03 02:22:33 +08:00
|
|
|
from torch import _assert
|
2021-11-03 00:21:40 +08:00
|
|
|
except ImportError:
|
2021-11-03 02:22:33 +08:00
|
|
|
def _assert(condition: bool, message: str):
|
|
|
|
assert condition, message
|
2021-11-03 00:21:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
def _float_to_int(x: float) -> int:
|
|
|
|
"""
|
|
|
|
Symbolic tracing helper to substitute for inbuilt `int`.
|
|
|
|
Hint: Inbuilt `int` can't accept an argument of type `Proxy`
|
|
|
|
"""
|
|
|
|
return int(x)
|