提交 2aaf1f31 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!1961 fixed LeakyReLU

Merge pull request !1961 from jiangjinsheng/issue_net
...@@ -249,11 +249,11 @@ class LeakyReLU(Cell): ...@@ -249,11 +249,11 @@ class LeakyReLU(Cell):
self.alpha = alpha self.alpha = alpha
def construct(self, x): def construct(self, x):
alpha = P.Cast()(F.scalar_to_array(self.alpha), P.DType()(x)) alpha_array = P.Cast()(F.scalar_to_array(self.alpha), P.DType()(x))
if alpha <= 1: if self.alpha <= 1:
out = P.Maximum()(alpha * x, x) out = P.Maximum()(alpha_array * x, x)
else: else:
out = P.Minimum()(alpha * x, x) out = P.Minimum()(alpha_array * x, x)
return out return out
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册