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/09 12:39:32 UTC

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

mozga-intel opened a new pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505


   ## Description ##
   Loop control variable 'x' is not used within the loop body. If this is intended, start the name with an underscore.
   
   ## Checklist ##
   ### Essentials ###
   - [ ] PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage
   - [ ] Code is well-documented
   
   ### Changes ###
   - [ ] Feature1, tests, (and when applicable, API doc)
   - [ ] Feature2, tests, (and when applicable, API doc)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be made.
   - Interesting edge cases to note here
   


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



[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

Posted by GitBox <gi...@apache.org>.
mozga-intel commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-895910015


   @mxnet-bot run ci [website]


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



[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

Posted by GitBox <gi...@apache.org>.
mozga-intel commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-896091412


   @mxnet-bot run ci [website]


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



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

Posted by GitBox <gi...@apache.org>.
mozga-intel edited a comment on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-895899658






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



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

Posted by GitBox <gi...@apache.org>.
szha merged pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505


   


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



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

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-896091467


   Jenkins CI successfully triggered : [website]


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



[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

Posted by GitBox <gi...@apache.org>.
mozga-intel commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-896166583


   @mxnet-bot run ci [website, centos-gpu]


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



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

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-896166629


   Jenkins CI successfully triggered : [website, centos-gpu]


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



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

Posted by GitBox <gi...@apache.org>.
szha commented on a change in pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#discussion_r695844760



##########
File path: python/mxnet/operator.py
##########
@@ -824,7 +824,7 @@ def infer_storage_type_backward_entry(num_tensor, tensor_stypes, tags, _):
                         "entries in returned aux stypes, " \
                         "got %d."%(len(tensors[4]), len(ret[4]))
                     rstype = []
-                    for i, ret_list in enumerate(ret):
+                    for _, ret_list in enumerate(ret):

Review comment:
       ```suggestion
                       for ret_list in ret:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -382,25 +382,25 @@ def test_dataset_filter():
     a = mx.gluon.data.SimpleDataset([i for i in range(length)])
     a_filtered = a.filter(lambda x: x % 10 == 0)
     assert(len(a_filtered) == 10)
-    for idx, sample in enumerate(a_filtered):
+    for _, sample in enumerate(a_filtered):

Review comment:
       ```suggestion
       for sample in a_filtered:
   ```

##########
File path: python/mxnet/test_utils.py
##########
@@ -1584,7 +1584,7 @@ def smaller_dtype(dt1, dt2):
             else:
                 arg_params[n] = np.random.normal(size=arr.shape,
                                                  scale=scale).astype(rand_type)
-    for n, arr in exe_list[0].aux_dict.items():
+    for n, _ in exe_list[0].aux_dict.items():

Review comment:
       ```suggestion
       for n in exe_list[0].aux_dict:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -382,25 +382,25 @@ def test_dataset_filter():
     a = mx.gluon.data.SimpleDataset([i for i in range(length)])
     a_filtered = a.filter(lambda x: x % 10 == 0)
     assert(len(a_filtered) == 10)
-    for idx, sample in enumerate(a_filtered):
+    for _, sample in enumerate(a_filtered):
         assert sample % 10 == 0
     a_xform_filtered = a.transform(lambda x: x + 1).filter(lambda x: x % 10 == 0)
     assert(len(a_xform_filtered) == 10)
     # the filtered data is already transformed
-    for idx, sample in enumerate(a_xform_filtered):
+    for _, sample in enumerate(a_xform_filtered):

Review comment:
       ```suggestion
       for sample in a_xform_filtered:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -325,14 +325,14 @@ def _batchify(data):
 def test_multi_worker_forked_data_loader():
     data = _Dummy(False)
     loader = DataLoader(data, batch_size=40, batchify_fn=_batchify, num_workers=2)
-    for epoch in range(1):
-        for i, data in enumerate(loader):
+    for _ in range(1):
+        for _ in enumerate(loader):

Review comment:
       ```suggestion
           for _ in loader:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -451,7 +451,7 @@ def test_dataset_take():
     assert len(a_take_10) == count
     expected_total = sum([i for i in range(count)])
     total = 0
-    for idx, sample in enumerate(a_take_10):
+    for _, sample in enumerate(a_take_10):

Review comment:
       ```suggestion
       for sample in a_take_10:
   ```

##########
File path: tests/python/unittest/test_gluon_probability_v2.py
##########
@@ -1842,7 +1842,7 @@ def forward(self, loc, scale, *args):
                             rtol=1e-3, use_broadcast=False)
 
     # Test sampling
-    for shape, hybridize in itertools.product(shapes, [True, False]):
+    for shape, _ in itertools.product(shapes, [True, False]):

Review comment:
       I think hybridize should be kept and on line 1854 insert the following
   ```python
           if hybridize:
               net.hybridize()
   ```

##########
File path: python/mxnet/gluon/contrib/estimator/estimator.py
##########
@@ -392,7 +392,7 @@ def fit(self, train_data,
             for handler in epoch_begin:
                 handler.epoch_begin(estimator_ref)
 
-            for i, batch in enumerate(train_data):
+            for _, batch in enumerate(train_data):

Review comment:
       ```suggestion
               for batch in train_data:
   ```

##########
File path: tests/python/unittest/test_numpy_op.py
##########
@@ -8396,7 +8396,7 @@ def dbg(name, data):
                                           dtype=dtype))
                 for optimize in [False, True]:
                     x = []
-                    for (iop, op) in enumerate(operands):
+                    for (iop, _) in enumerate(operands):

Review comment:
       ```suggestion
                       for iop in range(len(operands)):
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -417,7 +417,7 @@ def test_dataset_shard():
     assert len(shard_3) == 2
     total = 0
     for shard in [shard_0, shard_1, shard_2, shard_3]:
-        for idx, sample in enumerate(shard):
+        for _, sample in enumerate(shard):

Review comment:
       ```suggestion
           for sample in shard:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -382,25 +382,25 @@ def test_dataset_filter():
     a = mx.gluon.data.SimpleDataset([i for i in range(length)])
     a_filtered = a.filter(lambda x: x % 10 == 0)
     assert(len(a_filtered) == 10)
-    for idx, sample in enumerate(a_filtered):
+    for _, sample in enumerate(a_filtered):
         assert sample % 10 == 0
     a_xform_filtered = a.transform(lambda x: x + 1).filter(lambda x: x % 10 == 0)
     assert(len(a_xform_filtered) == 10)
     # the filtered data is already transformed
-    for idx, sample in enumerate(a_xform_filtered):
+    for _, sample in enumerate(a_xform_filtered):
         assert sample % 10 == 0
 
 def test_dataset_filter_handle():
     length = 100
     a = mx.gluon.data.SimpleDataset(np.arange(length))
     a_filtered = a.filter(lambda x: x % 10 == 0).__mx_handle__()
     assert(len(a_filtered) == 10)
-    for idx, sample in enumerate(a_filtered):
+    for _, sample in enumerate(a_filtered):

Review comment:
       ```suggestion
       for sample in a_filtered:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -325,14 +325,14 @@ def _batchify(data):
 def test_multi_worker_forked_data_loader():
     data = _Dummy(False)
     loader = DataLoader(data, batch_size=40, batchify_fn=_batchify, num_workers=2)
-    for epoch in range(1):
-        for i, data in enumerate(loader):
+    for _ in range(1):
+        for _ in enumerate(loader):
             pass
 
     data = _Dummy(True)
     loader = DataLoader(data, batch_size=40, batchify_fn=_batchify_list, num_workers=2)
-    for epoch in range(1):
-        for i, data in enumerate(loader):
+    for _ in range(1):
+        for _ in enumerate(loader):

Review comment:
       ```suggestion
           for _ in loader:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -435,7 +435,7 @@ def test_dataset_shard_handle():
     assert len(shard_3) == 2
     total = 0
     for shard in [shard_0, shard_1, shard_2, shard_3]:
-        for idx, sample in enumerate(shard):
+        for _, sample in enumerate(shard):

Review comment:
       ```suggestion
           for sample in shard:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -382,25 +382,25 @@ def test_dataset_filter():
     a = mx.gluon.data.SimpleDataset([i for i in range(length)])
     a_filtered = a.filter(lambda x: x % 10 == 0)
     assert(len(a_filtered) == 10)
-    for idx, sample in enumerate(a_filtered):
+    for _, sample in enumerate(a_filtered):
         assert sample % 10 == 0
     a_xform_filtered = a.transform(lambda x: x + 1).filter(lambda x: x % 10 == 0)
     assert(len(a_xform_filtered) == 10)
     # the filtered data is already transformed
-    for idx, sample in enumerate(a_xform_filtered):
+    for _, sample in enumerate(a_xform_filtered):
         assert sample % 10 == 0
 
 def test_dataset_filter_handle():
     length = 100
     a = mx.gluon.data.SimpleDataset(np.arange(length))
     a_filtered = a.filter(lambda x: x % 10 == 0).__mx_handle__()
     assert(len(a_filtered) == 10)
-    for idx, sample in enumerate(a_filtered):
+    for _, sample in enumerate(a_filtered):
         assert sample % 10 == 0
     a_xform_filtered = a.transform(lambda x: x + 1).filter(lambda x: x % 10 == 0)
     assert(len(a_xform_filtered) == 10)
     # the filtered data is already transformed
-    for idx, sample in enumerate(a_xform_filtered):
+    for _, sample in enumerate(a_xform_filtered):

Review comment:
       ```suggestion
       for sample in a_xform_filtered:
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -477,7 +477,7 @@ def test_dataset_take_handle():
     assert len(a_take_10) == count
     expected_total = sum([i for i in range(count)])
     total = 0
-    for idx, sample in enumerate(a_take_10):
+    for _, sample in enumerate(a_take_10):

Review comment:
       ```suggestion
       for sample in a_take_10:
   ```

##########
File path: tests/python/unittest/test_numpy_interoperability.py
##########
@@ -421,7 +421,7 @@ def _add_workload_swapaxes():
     # assertRaises(np.AxisError, np.swapaxes, -5, 0)
     for i in range(-4, 4):
         for j in range(-4, 4):
-            for k, src in enumerate((a, b)):
+            for _, src in enumerate((a, b)):

Review comment:
       ```suggestion
               for src in (a, b):
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -486,7 +486,7 @@ def test_dataset_take_handle():
     assert len(a_xform_take_10) == count
     expected_total = sum([i for i in range(count)])
     total = 0
-    for idx, sample in enumerate(a_xform_take_10):
+    for _, sample in enumerate(a_xform_take_10):

Review comment:
       ```suggestion
       for sample in a_xform_take_10:
   ```

##########
File path: tests/python/unittest/test_numpy_op.py
##########
@@ -8410,10 +8410,10 @@ def dbg(name, data):
                     assert_almost_equal(out_mx.asnumpy(), expected_np, rtol=rtol, atol=atol)
                     out_mx.backward()
                     cur_grad = []
-                    for (iop, op) in enumerate(x):
+                    for (_, op) in enumerate(x):

Review comment:
       ```suggestion
                       for op in x:
   ```

##########
File path: tests/python/unittest/test_numpy_op.py
##########
@@ -4846,7 +4846,7 @@ def forward(self, param1, param2):
     dtypes = ['float16', 'float32', 'float64']
     op_names = ['uniform_n', 'normal_n']
 
-    for bshape, eshape, dtype, op in itertools.product(batch_shapes, event_shapes, dtypes, op_names):
+    for bshape, eshape, _, op in itertools.product(batch_shapes, event_shapes, dtypes, op_names):

Review comment:
       dtype should be added to line 4834 and 4842 so that different data types are actually tested.

##########
File path: tests/python/unittest/test_numpy_op.py
##########
@@ -8410,10 +8410,10 @@ def dbg(name, data):
                     assert_almost_equal(out_mx.asnumpy(), expected_np, rtol=rtol, atol=atol)
                     out_mx.backward()
                     cur_grad = []
-                    for (iop, op) in enumerate(x):
+                    for (_, op) in enumerate(x):
                         cur_grad.append(op.grad.asnumpy())
                     grad.append(cur_grad)
-                for (iop, op) in enumerate(grad[0]):
+                for (iop, _) in enumerate(grad[0]):

Review comment:
       ```suggestion
                   for iop in range(len(grad[0])):
   ```

##########
File path: tests/python/unittest/test_gluon_data.py
##########
@@ -460,7 +460,7 @@ def test_dataset_take():
     assert len(a_xform_take_10) == count
     expected_total = sum([i * 10 for i in range(count)])
     total = 0
-    for idx, sample in enumerate(a_xform_take_10):
+    for _, sample in enumerate(a_xform_take_10):

Review comment:
       ```suggestion
       for sample in a_xform_take_10:
   ```




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



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

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-895910076


   Jenkins CI successfully triggered : [website]


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



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

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-904711598


   Jenkins CI successfully triggered : [unix-gpu, centos-gpu]


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



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

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-895188605


   Hey @mozga-intel , Thanks for submitting the PR 
   All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands: 
   - To trigger all jobs: @mxnet-bot run ci [all] 
   - To trigger specific jobs: @mxnet-bot run ci [job1, job2] 
   *** 
   **CI supported jobs**: [unix-gpu, clang, windows-cpu, unix-cpu, miscellaneous, sanity, centos-cpu, centos-gpu, windows-gpu, edge, website]
   *** 
   _Note_: 
    Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin. 
   All CI tests must pass before the PR can be merged. 
   


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



[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

Posted by GitBox <gi...@apache.org>.
mozga-intel commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-901684931


   > > Could you please tell whether the lines L4191 to L4231 shouldn't be placed in the loop scope to get a changeable axis?
   > 
   > I think that would make more sense than what the test currently does.
   
   @szha Thanks! There is a pull request that includes this change: #20532


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



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

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-896091112


   Jenkins CI successfully triggered : [centos-gpu]


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



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

Posted by GitBox <gi...@apache.org>.
szha commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-901273452


   > Could you please tell whether the lines L4191 to L4231 shouldn't be placed in the loop scope to get a changeable axis?
   
   I think that would make more sense than what the test currently does.


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



[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

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



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

Posted by GitBox <gi...@apache.org>.
bgawrych commented on a change in pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#discussion_r693931632



##########
File path: python/mxnet/gluon/contrib/estimator/estimator.py
##########
@@ -392,7 +392,7 @@ def fit(self, train_data,
             for handler in epoch_begin:
                 handler.epoch_begin(estimator_ref)
 
-            for i, batch in enumerate(train_data):
+            for _, batch in enumerate(train_data):

Review comment:
       in most of the cases enumerate makes no sense




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



[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

Posted by GitBox <gi...@apache.org>.
mozga-intel commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-896091042


   @mxnet-bot run ci [centos-gpu]


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



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

Posted by GitBox <gi...@apache.org>.
mozga-intel edited a comment 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; There is the similar issue: #20508
   
   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



[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

Posted by GitBox <gi...@apache.org>.
mozga-intel commented on pull request #20505:
URL: https://github.com/apache/incubator-mxnet/pull/20505#issuecomment-904711522


    @mxnet-bot run ci [centos-gpu, unix-gpu]


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