改进softmax函数 def softmax1(x): # 二维矩阵处理办法 if x.ndim == 2: x = x.T max=np.max(x, axis=0) x = x - max y = np.exp(x) / np.sum(np.exp(x), axis=0) return y.T # 一维数组处理办法 max = np.max(x, axis=0) x = x - max # 溢出对策 return np.exp(x) / np.sum(np.exp(x)) 思考 发生转置 100*10的元祖 计算结果 晕晕晕~~~~~~~~~~