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

Function _gen_repeat_idx

imperative/python/megengine/functional/loss.py:299–303  ·  view source on GitHub ↗
(inp: Tensor)

Source from the content-addressed store, hash-verified

297
298
299def _gen_repeat_idx(inp: Tensor):
300 idx = cumsum(inp, axis=0)
301 ret = zeros(inp.sum(), dtype="int32")
302 ret[idx[:-1]] = 1
303 return cumsum(ret, axis=0)
304
305
306def _gen_tile_idx(inp: Tensor):

Callers 1

_expand_labelFunction · 0.85

Calls 3

cumsumFunction · 0.85
zerosFunction · 0.70
sumMethod · 0.45

Tested by

no test coverage detected