XJDKC commented on a change in pull request #731:
URL: https://github.com/apache/singa/pull/731#discussion_r440732669



##########
File path: python/singa/layer.py
##########
@@ -499,7 +581,7 @@ def initialize(self, x):
             self.kernel_size[0],
             self.kernel_size[1],
         )
-        w_name = self.name + Layer.sep + 'W'
+        w_name = self.get_param_name('W')

Review comment:
       We can't implement like that. \_\_setattr\_\_ will be called if users 
want to set an attr. But if they modify the name of the Tensor like this`W.name 
= "Weight"`, \_\_setattr\_\_ won't be called. And we can't prevent users from 
changing the name by adding Tensor.\_\_setattr\_\_ because this tensor might 
not a param of a layer.

##########
File path: python/singa/layer.py
##########
@@ -499,7 +581,7 @@ def initialize(self, x):
             self.kernel_size[0],
             self.kernel_size[1],
         )
-        w_name = self.name + Layer.sep + 'W'
+        w_name = self.get_param_name('W')

Review comment:
       We can't implement like that. \_\_setattr\_\_ will be called if users 
want to set an attr. But if they modify the name of the Tensor like this`W.name 
= "Weight"`, \_\_setattr\_\_ won't be called. And we can't prevent users from 
changing the name by adding Tensor.\_\_setattr\_\_ because this tensor might 
not be a param of a layer.




----------------------------------------------------------------
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:
[email protected]


Reply via email to