MCPcopy Create free account
hub / github.com/apache/tvm / _mod_inverse

Function _mod_inverse

python/tvm/tirx/exec_context.py:69–75  ·  view source on GitHub ↗
(value: int, modulus: int)

Source from the content-addressed store, hash-verified

67
68
69def _mod_inverse(value: int, modulus: int) -> int:
70 if modulus == 1:
71 return 0
72 gcd, inv, _ = _extended_gcd(value % modulus, modulus)
73 if gcd != 1:
74 raise ExecContextError(f"{value} has no inverse modulo {modulus}")
75 return inv % modulus
76
77
78@dataclass(frozen=True)

Callers 1

moduloMethod · 0.85

Calls 2

_extended_gcdFunction · 0.85
ExecContextErrorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…