Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Fix iterator over symbol when multiple children have the same name #14597

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

ptrendx
Copy link
Member

@ptrendx ptrendx commented Apr 2, 2019

Description

In the current version of MXNet iterating over grouped symbol containing duplicates is impossible:

>>> import mxnet as mx
>>> a = mx.sym.Variable('data')
>>> b = a + a
>>> for c in b.get_children();
>>>    pass
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/runner/.local/lib/python3.6/site-packages/mxnet/symbol/symbol.py", line 93, in <genexpr>
    return (self[i] for i in self.list_outputs())
  File "/home/runner/.local/lib/python3.6/site-packages/mxnet/symbol/symbol.py", line 517, in __getitem__
    raise ValueError('There are multiple outputs with name \"%s\"' % index)
ValueError: There are multiple outputs with name "data"

This PR fixes that.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)

@ptrendx ptrendx requested a review from szha as a code owner April 2, 2019 13:57
@piyushghai
Copy link
Contributor

@ptrendx Thanks for fixing this.

@mxnet-label-bot Add [Symbol, backend, pr-awaiting-review]

@marcoabreu marcoabreu added Backend Issues related to the backend of MXNet pr-awaiting-review PR is waiting for code review Symbol labels Apr 2, 2019
@Roshrini
Copy link
Member

LGTM

@roywei
Copy link
Member

roywei commented Apr 29, 2019

@Roshrini @sandeep-krishnamurthy could you help merge this?

@szha szha merged commit 488fad2 into apache:master Apr 30, 2019
access2rohit pushed a commit to access2rohit/incubator-mxnet that referenced this pull request May 14, 2019
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Backend Issues related to the backend of MXNet pr-awaiting-review PR is waiting for code review Symbol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants