評價此頁

torch.nn.functional.prelu#

torch.nn.functional.prelu(input, weight) Tensor#

逐元素應用函式 PReLU(x)=max(0,x)+weightmin(0,x)\text{PReLU}(x) = \max(0,x) + \text{weight} * \min(0,x) 其中 weight 是一個可學習的引數。

注意

weight 期望是一個標量或一維張量。如果 weight 是一維的,其大小必須與輸入通道數匹配,當 input.dim() >= 2 時由 input.size(1) 確定,否則為 1。在一維情況下,請注意,當 input 的維度大於 2 時,weight 可以擴充套件到 input 的形狀,這無法透過正常的 廣播語義 實現。

有關更多詳細資訊,請參閱 PReLU