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/18 06:02:31 UTC
[GitHub] szha commented on a change in pull request #12209: Make the output
format of foreach consistent with while_loop
szha commented on a change in pull request #12209: Make the output format of foreach consistent with while_loop
URL: https://github.com/apache/incubator-mxnet/pull/12209#discussion_r211066371
##########
File path: python/mxnet/ndarray/contrib.py
##########
@@ -98,6 +98,39 @@ def rand_zipfian(true_classes, num_sampled, range_max, ctx=None):
return sampled_classes, expected_count_true, expected_count_sampled
# pylint: enable=line-too-long
+
+def _flatten(args, inout_str):
+ if isinstance(args, ndarray.NDArray):
+ return [args], int(0)
+
+ assert isinstance(args, (list, tuple)), \
+ "HybridBlock %s must be (nested) list of Symbol or NDArray, " \
+ "but got %s of type %s"%(inout_str, str(args), str(type(args)))
Review comment:
please don't just copy. extract this into a utils module and use it in both hybridblock and control flow ops.
----------------------------------------------------------------
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