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 2018/08/11 21:25:36 UTC
[GitHub] zheng-da commented on a change in pull request #12106: [MXNET-795]
Fix a bug that CutSubgraph works only when each subgraph has its distinct
name
zheng-da commented on a change in pull request #12106: [MXNET-795] Fix a bug that CutSubgraph works only when each subgraph has its distinct name
URL: https://github.com/apache/incubator-mxnet/pull/12106#discussion_r209437878
##########
File path: tests/python/unittest/test_contrib_control_flow.py
##########
@@ -1765,6 +1767,45 @@ def hybrid_forward(self, F, data):
assert_almost_equal(res1.asnumpy(), res2.asnumpy(), rtol=0.001, atol=0.0001)
+def test_scope():
+ class TestBlock1(gluon.HybridBlock):
+ def __init__(self, prefix=None, params=None):
+ super(TestBlock1, self).__init__(prefix=prefix, params=params)
+ def hybrid_forward(self, F, data):
+ (new_data, ) = F.contrib.cond(
+ data > 0.5,
+ then_func=lambda: data * 2,
+ else_func=lambda: data * 3,
+ name="my_cond",
+ )
+ return new_data
+ class TestBlock2(gluon.HybridBlock):
+ def __init__(self, prefix=None, params=None):
+ super(TestBlock2, self).__init__(prefix=prefix, params=params)
+ def hybrid_forward(self, F, data):
+ (new_data, ) = F.contrib.cond(
+ data > 0.5,
+ then_func=lambda: data * 2,
+ else_func=lambda: data * 3,
+ name="my_cond",
+ )
+ return new_data
+ AttrScope._subgraph_names = defaultdict(int)
Review comment:
do we need to define this?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services