import numpy as np
def softmax(x): """ Softmax函数实现 """ e_x = np.exp(x - np.max(x)) return e_x / e_x.sum()
input_numbers = np.array([-2, 1, 3, -1, 0, 2, 4, -3])
softmax_result = softmax(input_numbers)
print(softmax_result)