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

Function np_softmax

imperative/python/test/unit/functional/test_functional.py:1694–1695  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

1692@pytest.mark.skip(reason="pytest aborted")
1693def test_softmax():
1694 def np_softmax(x):
1695 return np.exp(x) / np.sum(np.exp(x), axis=1, keepdims=True)
1696
1697 data = (np.random.random(size=(1, 16, 224, 224)).astype(np.float32) - 0.5) * 100
1698 desired = np_softmax(data[:, :3, 0, 0])

Callers 1

test_softmaxFunction · 0.85

Calls 2

expMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected