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

Function dim2val

imperative/python/megengine/functional/einsum.py:379–386  ·  view source on GitHub ↗
(dim: str)

Source from the content-addressed store, hash-verified

377 dim2val_cache = {}
378
379 def dim2val(dim: str):
380 if dim in dim2val_cache:
381 return dim2val_cache[dim]
382 for i, shape in enumerate(shapes):
383 if dim in shape:
384 dim2val_cache[dim] = inputs[i].shape[shape.index(dim)]
385 break
386 return dim2val_cache[dim]
387
388 def dims2val(dims: str):
389 if len(dims) == 0:

Callers

nothing calls this directly

Calls 2

GetVarShapeMethod · 0.80
fFunction · 0.50

Tested by

no test coverage detected