From dev-return-3040-archive-asf-public=cust-asf.ponee.io@singa.incubator.apache.org Mon Jul 29 12:09:37 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id F395E18063F for ; Mon, 29 Jul 2019 14:09:36 +0200 (CEST) Received: (qmail 96593 invoked by uid 500); 29 Jul 2019 12:09:36 -0000 Mailing-List: contact dev-help@singa.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@singa.incubator.apache.org Delivered-To: mailing list dev@singa.incubator.apache.org Received: (qmail 96582 invoked by uid 99); 29 Jul 2019 12:09:36 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jul 2019 12:09:36 +0000 From: GitBox To: dev@singa.apache.org Subject: [GitHub] [incubator-singa] ShichengChen commented on a change in pull request #480: SINGA-474 ELU operator Message-ID: <156440217637.2120.14367926390153143288.gitbox@gitbox.apache.org> Date: Mon, 29 Jul 2019 12:09:36 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit ShichengChen commented on a change in pull request #480: SINGA-474 ELU operator URL: https://github.com/apache/incubator-singa/pull/480#discussion_r308194125 ########## File path: python/singa/autograd.py ########## @@ -358,6 +358,37 @@ def relu(x): return ReLU()(x)[0] +class Elu(Operation): + def __init__(self,alpha=1): + super(Elu, self).__init__() + self.alpha=alpha + + def forward(self, x): + #f(x) = alpha * (exp(x) - 1.) for x < 0, f(x) = x for x >= 0 + if training: + self.input = x + x1 = singa.LTFloat(x, 0.0) + x1 = singa.__mul__(x, x1) + x1 = singa.MultFloat(singa.SubFloat(singa.Exp(x1),self.alpha),1) Review comment: yes, I just remove *1 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services