MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / NonExistNum

Class NonExistNum

imperative/python/megengine/utils/profile_analyzer.py:10–50  ·  view source on GitHub ↗

r"""An object that behaves like a number but means a field does not exist; It is always greater than any real number.

Source from the content-addressed store, hash-verified

8
9
10class NonExistNum:
11 r"""An object that behaves like a number but means a field does not exist; It is
12 always greater than any real number.
13 """
14
15 def __truediv__(self, _):
16 return self
17
18 def __add__(self, rhs):
19 return rhs
20
21 def __radd__(self, lhs):
22 return lhs
23
24 def __neg__(self):
25 return self
26
27 def __gt__(self, rhs):
28 if isinstance(rhs) is NonExistNum:
29 return id(self) > id(rhs)
30 return True
31
32 def __ge__(self, rhs):
33 return self > rhs or self == rhs
34
35 def __lt__(self, rhs):
36 if isinstance(rhs) is NonExistNum:
37 return id(self) < id(rhs)
38 return False
39
40 def __le__(self, rhs):
41 return self < rhs or self == rhs
42
43 def __eq__(self, rhs):
44 return self is rhs
45
46 def __format__(self, spec):
47 return "N/A"
48
49 def __repr__(self):
50 return "N/A"
51
52
53class OprProfRst:

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected