From dev-return-3336-archive-asf-public=cust-asf.ponee.io@singa.incubator.apache.org Wed Aug 14 13:38:58 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 9EE8A1802C7 for ; Wed, 14 Aug 2019 15:38:58 +0200 (CEST) Received: (qmail 53087 invoked by uid 500); 14 Aug 2019 13:38:58 -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 53077 invoked by uid 99); 14 Aug 2019 13:38:58 -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; Wed, 14 Aug 2019 13:38:58 +0000 From: GitBox To: dev@singa.apache.org Subject: [GitHub] [incubator-singa] pinpom commented on a change in pull request #510: SINGA 475 - add min operator Message-ID: <156578993803.5767.12220665462507637599.gitbox@gitbox.apache.org> Date: Wed, 14 Aug 2019 13:38:58 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit pinpom commented on a change in pull request #510: SINGA 475 - add min operator URL: https://github.com/apache/incubator-singa/pull/510#discussion_r313878087 ########## File path: python/singa/autograd.py ########## @@ -1945,3 +1945,29 @@ def backward(self, dy): def sub(a, b): return Sub()(a,b)[0] + + +class Min(Operation): + def __init__(self): + super(Min, self).__init__() + + def forward(self, a, b): + m = singa.__sub__(a,b) + mask0 = singa.LTFloat(m,0) + mask00 = singa.__mul__(singa.LEFloat(m,0),a) + mask1 = singa.GTFloat(m,0) + mask11=singa.__mul__(mask1,b) + mask = singa.__add__(mask00,mask11) + + if training: + self.mask = mask Review comment: yes. only used in forward function ---------------------------------------------------------------- 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