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

Method normalize

dnn/scripts/gen_param_defs.py:136–144  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

134
135 def normalize_enum_value(self, value):
136 def normalize(v):
137 if isinstance(v, str):
138 for idx, m in enumerate(self.members):
139 m = str(m).split(" ")[0].split("=")[0]
140 if v == m:
141 return idx
142 raise ValueError("enum member '{}' does not exist.".format(v))
143 assert isinstance(v, int)
144 return v
145
146 if self.combined:
147 if isinstance(value, int):

Callers 1

test_normalizeFunction · 0.80

Calls 2

strFunction · 0.85
formatMethod · 0.45

Tested by 1

test_normalizeFunction · 0.64