singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-singa] nudles commented on a change in pull request #475: SINGA-463 fixed python test_operation
Date Wed, 03 Jul 2019 13:46:22 GMT
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_r299964637
 
 

 ##########
 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)
 
 Review comment:
   maybe use an empty tensor like this https://github.com/apache/incubator-singa/blob/0aae4c12cbc94d88a6c77793a7106c292925aac7/python/singa/autograd.py#L801

----------------------------------------------------------------
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

Mime
View raw message