目录
numpy softmax函数
def softmax(x, axis=None):
x_exp = np.exp(x - np.max(x, axis=axis, keepdims=True))
return x_exp / np.sum(x_exp, axis=axis, keepdims=True)
out=softmax(output[0][0],axis=0)
index_max = np.argmax(out, axis=0)
print(index_max,out[index_max])
单维度 argmax,max函数:
import numpy as np
a = np.array([3, 1, 2, 4, 6, 1])
print(np.argmax(a))
4
print(a.max())