MCPcopy Index your code
hub / github.com/patrickloeber/pytorchTutorial / softmax

Function softmax

11_softmax_and_crossentropy.py:18–19  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

16# -> squashes the output to be between 0 and 1 = probability
17# sum of all probabilities is 1
18def softmax(x):
19 return np.exp(x) / np.sum(np.exp(x), axis=0)
20
21x = np.array([2.0, 1.0, 0.1])
22outputs = softmax(x)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected