This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 488fad2  Fix iterator over symbol when multiple children have the same 
name (#14597)
488fad2 is described below

commit 488fad2c5c61b8f31c91687f8c19dacb6818b076
Author: Przemyslaw Tredak <[email protected]>
AuthorDate: Tue Apr 30 21:18:11 2019 +0200

    Fix iterator over symbol when multiple children have the same name (#14597)
---
 python/mxnet/symbol/symbol.py        | 2 +-
 tests/python/unittest/test_symbol.py | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/python/mxnet/symbol/symbol.py b/python/mxnet/symbol/symbol.py
index 4bf60a6..0924b2f 100644
--- a/python/mxnet/symbol/symbol.py
+++ b/python/mxnet/symbol/symbol.py
@@ -90,7 +90,7 @@ class Symbol(SymbolBase):
         <Symbol d>
         <Symbol _plus0>
         """
-        return (self[i] for i in self.list_outputs())
+        return (self[i] for i in range(len(self)))
 
     def __add__(self, other):
         """x.__add__(y) <=> x+y
diff --git a/tests/python/unittest/test_symbol.py 
b/tests/python/unittest/test_symbol.py
index b290ff3..2dfe3e4 100644
--- a/tests/python/unittest/test_symbol.py
+++ b/tests/python/unittest/test_symbol.py
@@ -367,6 +367,11 @@ def test_simple_bind_gradient_graph_possible_with_cycle():
     res = data + data + data + data + data + data + data + data
     res.simple_bind(ctx=mx.cpu(), data=(1,))
 
+def test_children_same_name():
+    a = mx.sym.Variable('data')
+    b = a + a
+    for c in b.get_children():
+        pass
 
 if __name__ == '__main__':
     import nose

Reply via email to