You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/08/10 10:04:28 UTC

[GitHub] [incubator-mxnet] mozga-intel commented on pull request #20505: If variable is not used within the loop body, start the name with an underscore

mozga-intel commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-895899658


   @szha Could you help:  
   
   Please have a look at the test: [test](https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_operator.py#L4156). There is an axis param that is set up in a loop: [loop] Loop control variable 'axis' not used within the loop body but it's only used out of the loop scope: [loop](https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_operator.py#L4183)
   ```python
       for axis in range(-data_ndim, data_ndim):
           data_shape = ()
           for _ in range(data_ndim):
               data_shape += (np.random.randint(low=1, high=5), )
           idx_shape = ()
           for _ in range(idx_ndim):
               idx_shape += (np.random.randint(low=1, high=5), )
        ....
       
       result = mx.sym.take(a=data, indices=idx, axis=axis, mode=mode)
   ```
   The axis is always equal to `data_ndim- 1`.  Following the documentation [doc](https://mxnet.apache.org/versions/1.6/api/r/docs/api/mx.nd.take.html), the axis of an input array is to be taken. For the input tensor of rank r, it could be in the range of [-r, r-1]. Where r = data_ndim
   
   Could you please tell whether the lines [L4191](https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_operator.py#L4191) to [L4231](https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_operator.py#L4231) shouldn't be placed in the loop scope to get a changeable axis? 


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

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org