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/02 12:38:12 UTC

[GitHub] [singa] dcslin opened a new pull request #688: Autograd refactor

dcslin opened a new pull request #688:
URL: https://github.com/apache/singa/pull/688


   


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



[GitHub] [singa] dcslin commented on pull request #688: [stall]Layer auto detect input size

Posted by GitBox <gi...@apache.org>.
dcslin commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-632462338


   some of the work is merged into https://github.com/apache/singa/pull/697
   the rest need to be revised as api changed
   thus closing this PR


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



[GitHub] [singa] lgtm-com[bot] commented on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-624449526


   This pull request **introduces 2 alerts** and **fixes 1** when merging cd289d6e50484351b8568c100cf00d9728c84780 into 536f7e45e33ee0981dbae8ea4628905c3854c180 - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-e54bb20cc42e2891115d5f48757a2ef3c643e9f4)
   
   **new alerts:**
   
   * 2 for Unnecessary pass
   
   **fixed alerts:**
   
   * 1 for Unused local variable


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



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

Posted by GitBox <gi...@apache.org>.
nudles commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-628507144


   The following APIs should be backward compatible. Please test.
   
   ```python
   
   class Linear(Layer):
        def __init__(self, num_output, *args, bias=True, **kwargs):
             # the following block is for backward compatibility. 
             # the old code will all Linear(2, 3), or (2, 3, False)
             if len(args) > 0:
                num_input = num_output
                num_output = args[0]
             if len(args) > 1:
                bias = args[1]
   
          self.num_output = num_output
          self.bias = bias
   
   class Conv2d(Layer):
          def __init__(self,
                    out_channels,
                    kernel_size,
                    *args,
                    stride=1,
                    padding=0,
                    dilation=1,
                    group=1,
                    bias=True,
                    pad_mode="NOTSET",
                    **kwargs):
            # the old code create the layer like: Conv2d(8, 16, 3), or Conv2d(8, 16, 3, stride=1)
            # the following code block is for backward compatibility
            if len(args) >0:
              in_channel=out_channel
              out_channel = kernel
              kernel = args[0]
            if len(args) > 1:
              stride = args[1]
            if len(args) > 2:
              padding = args[2]
    ```
   
   
   
   
            


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



[GitHub] [singa] lgtm-com[bot] commented on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-624453771


   This pull request **introduces 2 alerts** when merging cd289d6e50484351b8568c100cf00d9728c84780 into db1846dd2c612950054f75b8125f40cd25a20f44 - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-2ab2e211bd53aae20803c78109dff690c7f7b334)
   
   **new alerts:**
   
   * 2 for Unnecessary pass


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



[GitHub] [singa] joddiy commented on pull request #688: [stall]Layer auto detect input size

Posted by GitBox <gi...@apache.org>.
joddiy commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-630096942


   > > Hi, @dcslin , can I use this PR right now or which operation I can use now? since I need to let the soonx to support the new autograd api.
   > 
   > Hi @joddiy please refer to #697
   
   Thanks, shicong, and one thing to confirm, the name of operation should be `_ReLU` or `ReLU`?


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



[GitHub] [singa] joddiy edited a comment on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
joddiy edited a comment on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-630022509


   Hi, @dcslin , can I use this PR right now or which operation I can use now? since I need to let the soonx to support the new autograd  api.


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



[GitHub] [singa] lgtm-com[bot] commented on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-624171758


   This pull request **introduces 2 alerts** when merging cd289d6e50484351b8568c100cf00d9728c84780 into e4082c600e7730b795e55ff3dd3b9df5b282389c - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-76acab69d5e78e56891845ee015be976d86de39b)
   
   **new alerts:**
   
   * 2 for Unnecessary pass


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



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

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [singa] lgtm-com[bot] commented on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-628981306


   This pull request **introduces 3 alerts** when merging 3d835a0d03d4f2172ede1f812a0508a4cd93cb77 into db1846dd2c612950054f75b8125f40cd25a20f44 - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-c32b7ed7c06733dda07d225da7dcbad88866b184)
   
   **new alerts:**
   
   * 2 for Unnecessary pass
   * 1 for Unused import


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



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

Posted by GitBox <gi...@apache.org>.
dcslin commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-624404188


   > > 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.
   
   ok thanks.
   
   Updated:
   changes No.4: modified the `__ini__` to parse `*args and **kwargs` for Linear, RNN, LSTM


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



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

Posted by GitBox <gi...@apache.org>.
joddiy commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-630022509


   Hi, @dcslin , can I use this PR right now? since I need to let the soonx to support the new autograd  api.


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



[GitHub] [singa] dcslin closed pull request #688: [stall]Layer auto detect input size

Posted by GitBox <gi...@apache.org>.
dcslin closed pull request #688:
URL: https://github.com/apache/singa/pull/688


   


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



[GitHub] [singa] nudles commented on pull request #688: [stall]Layer auto detect input size

Posted by GitBox <gi...@apache.org>.
nudles commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-631173608


   > 
   > 
   > > > > Hi, @dcslin , can I use this PR right now or which operation I can use now? since I need to let the soonx to support the new autograd api.
   > > > 
   > > > 
   > > > Hi @joddiy please refer to #697
   > > 
   > > 
   > > Thanks, shicong, and one thing to confirm, the name of operation should be `_ReLU` or `ReLU`?
   > 
   > I guess you are building the model? then by convention we use `autograd.relu()`
   
   I suggest to use layer.ReLU() to avoid mixing operators and layers in constructing the model.
   Refer to the first post in https://github.com/apache/singa/issues/696#issue-616336790


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



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

Posted by GitBox <gi...@apache.org>.
dcslin commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-622981796


   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.


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



[GitHub] [singa] lgtm-com[bot] commented on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-625026078


   This pull request **introduces 3 alerts** when merging e538fefb314d21e366a9d4eb58e0c5b9d3c49255 into db1846dd2c612950054f75b8125f40cd25a20f44 - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-bafa8765f5b36d4aa3c53980574d63656927f7ce)
   
   **new alerts:**
   
   * 2 for Unnecessary pass
   * 1 for Unused import


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



[GitHub] [singa] lgtm-com[bot] commented on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-623242606


   This pull request **introduces 1 alert** when merging 2b16b375e4af2affadc745fd3ec806967ddf752c into e4082c600e7730b795e55ff3dd3b9df5b282389c - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-1b8625c700e15996c033bf6e2b8f5feb704d03d8)
   
   **new alerts:**
   
   * 1 for Unnecessary pass


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



[GitHub] [singa] lgtm-com[bot] commented on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-622981779


   This pull request **introduces 1 alert** when merging dd0dc992fe6bc9bb4f7538abf102710636aea811 into e4082c600e7730b795e55ff3dd3b9df5b282389c - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-b70622c044be419dd4a3ca344bcbdae2ca58b6cd)
   
   **new alerts:**
   
   * 1 for Unnecessary pass


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



[GitHub] [singa] dcslin commented on pull request #688: [stall]Layer auto detect input size

Posted by GitBox <gi...@apache.org>.
dcslin commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-630891049


   > > > Hi, @dcslin , can I use this PR right now or which operation I can use now? since I need to let the soonx to support the new autograd api.
   > > 
   > > 
   > > Hi @joddiy please refer to #697
   > 
   > Thanks, shicong, and one thing to confirm, the name of operation should be `_ReLU` or `ReLU`?
   
   I guess you are building the model? then by convention we use `autograd.relu()`


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



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

Posted by GitBox <gi...@apache.org>.
dcslin commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-628979345


   update linear constructor, tested ok


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



[GitHub] [singa] dcslin commented on pull request #688: [stall]Layer auto detect in features

Posted by GitBox <gi...@apache.org>.
dcslin commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-630031726


   > Hi, @dcslin , can I use this PR right now or which operation I can use now? since I need to let the soonx to support the new autograd api.
   
   Hi @joddiy please refer to https://github.com/apache/singa/pull/697


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



[GitHub] [singa] lgtm-com[bot] commented on pull request #688: Autograd refactor

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #688:
URL: https://github.com/apache/singa/pull/688#issuecomment-625208134


   This pull request **introduces 3 alerts** when merging 4a98351365cf9da0ce5ff46f00580d71dbef0a13 into db1846dd2c612950054f75b8125f40cd25a20f44 - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-0389b8cbc6e752905f762c4dbdae517438bfc569)
   
   **new alerts:**
   
   * 2 for Unnecessary pass
   * 1 for Unused import


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