You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by GitBox <gi...@apache.org> on 2020/05/18 13:25:40 UTC

[GitHub] [singa] nudles edited a comment on pull request #697: New Model Layer Operator API

nudles edited a comment on pull request #697:
URL: https://github.com/apache/singa/pull/697#issuecomment-630181079


   > 
   > 
   > > > how about this scheme, `{"name": {"param": [0,...]}`, it should be easier to restore params/states:
   > > > ```
   > > > {'l1': {'W': [[ 0.09014801 -0.03559005]
   > > >  [-1.6343217  -1.0570787 ]
   > > >  [ 1.3426386   0.49866426]
   > > >  [ 0.27287227 -0.49320117]], 'b': [0. 0.]}}
   > > > ```
   > > 
   > > 
   > > Is it a recursive dict?
   > > One problem is readability, another problem is with Optimizer, which may store the first and second order moment of each param. Then we need a python dict with the key as the param name. Therefore, we need a unique name for each param.
   > > `get_param` and `get_state` should return a flat dict.
   > 
   > to avoid the recursive duct, we may can use this flat dict:
   > 
   > ```
   > {
   >     "<name of layer>:<name of sub_layer>:<name of sub_sub_layer>:<name of param>" : <value of param>
   > }
   > ```
   This one (above) is good for me.
   > 
   > or
   > 
   > ```
   > {
   >     "<name of layer>:<name of sub_layer>:<name of sub_sub_layer>" : 
   >     {
   >         "<name of param>" : <value of param>
   >     }
   > }
   > ```
   > 
   > And for onnx, the key of the dict(for both layers and params) should be unique.
   
   


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