From dev-return-2945-archive-asf-public=cust-asf.ponee.io@singa.incubator.apache.org Wed Jul 3 08:33:41 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 9B9BE180109 for ; Wed, 3 Jul 2019 10:33:41 +0200 (CEST) Received: (qmail 95680 invoked by uid 500); 3 Jul 2019 08:33:41 -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 95664 invoked by uid 99); 3 Jul 2019 08:33:41 -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, 03 Jul 2019 08:33:40 +0000 From: GitBox To: dev@singa.apache.org Subject: [GitHub] [incubator-singa] nudles commented on a change in pull request #475: SINGA-463 fixed python test_operation Message-ID: <156214282088.32044.1166977129703074498.gitbox@gitbox.apache.org> Date: Wed, 03 Jul 2019 08:33:40 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit nudles commented on a change in pull request #475: SINGA-463 fixed python test_operation URL: https://github.com/apache/incubator-singa/pull/475#discussion_r299836848 ########## File path: python/singa/autograd.py ########## @@ -924,17 +924,14 @@ def __init__( ) self.W.gaussian(0.0, std) - if self.bias: - b_shape = (self.out_channels,) - self.b = Tensor(shape=b_shape, requires_grad=True, stores_grad=True) - self.b.set_value(0.0) - else: - # to keep consistency when to do forward. - self.b = None - # Tensor(data=CTensor([]), requires_grad=False, stores_grad=False) + b_shape = (self.out_channels,) + # forward method required bias variable to proceed (dummy b tensor) + self.b = Tensor(shape=b_shape, requires_grad=self.bias, stores_grad=self.bias) + self.b.set_value(0.0) Review comment: the bias tensor cannot be created here because onnx will consider it a real bias (onnx has no bias_term flag). [this line](https://github.com/apache/incubator-singa/blob/b99aaa9f87ccbd4cf111e76013b8387b7129bd8b/python/singa/autograd.py#L791) should also be updated to set b as an optional argument `forward(self, x, W, b=None)`. You can create the tensor for b before calling the CPP 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