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



##########
File path: python/singa/layer.py
##########
@@ -158,6 +217,21 @@ def _get_unique_name(self):
             self.name = ''
         return self.name

Review comment:
       2.  we can try to reset the names recursively when layer1's name is set? 
   ```python
   def __set_attr__(self, name, value):
        if isinstance(value, layer) and layer.name is None: # set the name of a 
layer attribute
                if self.name != "":
                   prefix = self.name + Layer.sep
                else:
                   prefix = ""
      
                 value.name = prefix +  name
        elif name == 'name':  # reset the name of a layer attribute; triggered 
by the line above.
              for sublayer in self.sublayers:
                sublayer.name = value + Layer.sep + 
sublayer.name.split(Layer.sep)[-1]
              for pname, pval in self.get_params():
                pval.name = value + Param.sep + pval.name.split(Param.sep)[-1]
   ```
   
   3. we keep the user assigned name for tensors and do nothing for such cases.




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