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

Conversation

@roywei
Copy link
Member

@roywei roywei commented Sep 6, 2018

Description

Fix #12470

with this change, outs shape can be inferred correctly:

step = lambda data, states: (data + states[0], [states[0] * 2])
data = mx.sym.var('data', shape=(0,100))
states = [mx.sym.var('state')]
outs, states = mx.sym.contrib.foreach(step, data, states)
outs.infer_shape_partial()

>>>([(0L, 100L), (100L,)], [(0L, 100L)], [])

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:
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

remove check for 0 length

@roywei roywei requested a review from anirudh2290 as a code owner September 6, 2018 18:39
@roywei
Copy link
Member Author

roywei commented Sep 6, 2018

@zheng-da could you help review this? thanks!

@zheng-da
Copy link
Contributor

zheng-da commented Sep 7, 2018

@roywei could you add your example code to the test? We usually put tests on control flow operators here: tests/python/unittest/test_contrib_control_flow.py.

@roywei
Copy link
Member Author

roywei commented Sep 7, 2018

@zheng-da added unit test and CI passed

Copy link

@sandeep-krishnamurthy sandeep-krishnamurthy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thanks!

@sandeep-krishnamurthy sandeep-krishnamurthy merged commit 4eb7626 into apache:master Sep 8, 2018
aaronmarkham pushed a commit to aaronmarkham/incubator-mxnet that referenced this pull request Sep 11, 2018
* allow foreach on input with 0 length

* add test foreach with unknown dim
anirudh2290 pushed a commit to anirudh2290/mxnet that referenced this pull request Sep 19, 2018
* allow foreach on input with 0 length

* add test foreach with unknown dim
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

foreach operator does not support input's dimension unknown

3 participants