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

Function format_shapes

imperative/python/megengine/tools/profile_analyze.py:277–289  ·  view source on GitHub ↗
(shapes, layouts=None, sep="\n")

Source from the content-addressed store, hash-verified

275 return "\n".join(ret)
276
277 def format_shapes(shapes, layouts=None, sep="\n"):
278 if isinstance(shapes, NonExistNum) or shapes is None:
279 return repr(shapes)
280 if layouts is None:
281 layouts = [None] * len(shapes)
282
283 comp = []
284 for i, j in zip(shapes, layouts):
285 i = "{" + ",".join(map(str, i)) + "}"
286 if j:
287 i += "\n -[" + ",".join(map(str, j)) + "]"
288 comp.append(i)
289 return sep.join(comp)
290
291 def fix_num_and_find_unit(x, base):
292 if isinstance(x, NonExistNum) or (

Callers 1

prof_detailsFunction · 0.85

Calls 2

joinMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected