nndl / solutions

《神经网络与深度学习》课后习题答案-分享讨论
690 stars 80 forks source link

习题5-6 #45

Open simo-an opened 2 years ago

simo-an commented 2 years ago
题目

计算函数𝑦 = max(𝑥1, ⋯ , 𝑥𝐷)和函数𝑦 = arg max(𝑥1, ⋯ , 𝑥𝐷)的梯度.

解答

以D=2进行分析

  1. 对于 y = max(x1, x2) 当 x1 > x2 时,y=x1,梯度为(1, 0) 当 x1 < x2 时,y=x2,梯度为(0, 1) 当 x1 = x2 时,y不可导

  2. 对于 y = argmax(x1, x2) 当 x1 > x2 时,y=1,梯度为(0, 0) 当 x1 < x2 时,y=2,梯度为(0, 0) 当 x1 = x2 时,y不可导