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

Function ref

imperative/python/test/unit/functional/test_loss.py:29–30  ·  view source on GitHub ↗
(x, y)

Source from the content-addressed store, hash-verified

27 return x
28
29 def ref(x, y):
30 return np.mean([-np.log(x[i, y[i]]) for i in range(len(y))])
31
32 x = (np.random.rand(5, 10) - 0.5) * 4
33 y = np.random.randint(10, size=(5,))

Callers 7

test_cross_entropyFunction · 0.70
__call__Method · 0.50
__call__Method · 0.50
cbFunction · 0.50
test_attach_temporaryFunction · 0.50
parse_numberMethod · 0.50
TESTFunction · 0.50

Calls 2

meanMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected