Browse Source

!1961 fixed LeakyReLU

Merge pull request !1961 from jiangjinsheng/issue_net
tags/v0.5.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
2aaf1f3134
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      mindspore/nn/layer/activation.py

+ 4
- 4
mindspore/nn/layer/activation.py View File

@@ -249,11 +249,11 @@ class LeakyReLU(Cell):
self.alpha = alpha

def construct(self, x):
alpha = P.Cast()(F.scalar_to_array(self.alpha), P.DType()(x))
if alpha <= 1:
out = P.Maximum()(alpha * x, x)
alpha_array = P.Cast()(F.scalar_to_array(self.alpha), P.DType()(x))
if self.alpha <= 1:
out = P.Maximum()(alpha_array * x, x)
else:
out = P.Minimum()(alpha * x, x)
out = P.Minimum()(alpha_array * x, x)
return out




Loading…
Cancel
Save