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/04 02:34:58 UTC

[GitHub] [singa] nudles commented on pull request #688: Autograd refactor

nudles commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-623231858


   > 
   > 
   > changes:
   > 
   >     1. an example of make `class Xxx(Operation)` to private `class _Xxx(Operation)`. Because `class Operation` should be only for internal. For the term `Operation` in the user space, it should be the operation functions `def xxx(x):...`. Also these operation function should be used by the user
   > 
   >     2. fix bug for `set_param` when given Tensor as params
   > 
   >     3. Modified `Linear` constructor to `(self,out_features, in_features=None, bias=True):`. `out_features` comes first, leaving `in_features` as optional. When `Linear` is constructed with only `out_features`, it's params, `W` and `b`, are not initialized. After `set_params` or `forward`/`__call__`,  it's params, `W` and `b`, are initialized.
   
   For the last point, it will break the compatibility.. 
   there are two solutions
   1. use *args and **kwargs
   2. assume the old code passes (in_features, out_features, bias=True) and the new code passes (out_features, bias=True), then we check if in_features is None or not to decide the argument order. 
   
   In V4, we can update the API completely. 


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