{"action":"created","issue":{"url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12825","repository_url":"https://api.github.com/repos/apache/incubator-mxnet","labels_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12825/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12825/comments","events_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12825/events","html_url":"https://github.com/apache/incubator-mxnet/issues/12825","id":370282833,"node_id":"MDU6SXNzdWUzNzAyODI4MzM=","number":12825,"title":"Control flow operators do not work in imperative (NDArray) API","user":{"login":"samskalicky","id":1541993,"node_id":"MDQ6VXNlcjE1NDE5OTM=","avatar_url":"https://avatars2.githubusercontent.com/u/1541993?v=4","gravatar_id":"","url":"https://api.github.com/users/samskalicky","html_url":"https://github.com/samskalicky","followers_url":"https://api.github.com/users/samskalicky/followers","following_url":"https://api.github.com/users/samskalicky/following{/other_user}","gists_url":"https://api.github.com/users/samskalicky/gists{/gist_id}","starred_url":"https://api.github.com/users/samskalicky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samskalicky/subscriptions","organizations_url":"https://api.github.com/users/samskalicky/orgs","repos_url":"https://api.github.com/users/samskalicky/repos","events_url":"https://api.github.com/users/samskalicky/events{/privacy}","received_events_url":"https://api.github.com/users/samskalicky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-15T18:13:10Z","updated_at":"2018-10-15T18:14:07Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Description\r\nThe example for cond operator does not work for NDArray API from the website ([https://mxnet.incubator.apache.org/api/python/ndarray/contrib.html#mxnet.ndarray.contrib.cond]) \r\n\r\n```\r\na, b = mx.nd.array([1]), mx.nd.array([2])\r\npred = a * b < 5\r\nthen_func = lambda a, b: (a + 5) * (b + 5)\r\nelse_func = lambda a, b: (a - 5) * (b - 5)\r\noutputs = mx.nd.contrib.cond(pred, then_func, else_func)\r\noutputs[0]\r\n```\r\n\r\nWhen running this with v1.3.x here is the output:\r\n\r\n```\r\n>>> a, b = mx.nd.array([1]), mx.nd.array([2])\r\n>>> pred = a * b < 5\r\n>>> then_func = lambda a, b: (a + 5) * (b + 5)\r\n>>> else_func = lambda a, b: (a - 5) * (b - 5)\r\n>>> outputs = mx.nd.contrib.cond(pred, then_func, else_func)\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/local/lib/python2.7/site-packages/mxnet/ndarray/contrib.py\", line 460, in cond\r\n    return then_func()\r\nTypeError: <lambda>() takes exactly 2 arguments (0 given)\r\n```\r\n\r\nThe symbolic API example does work for the cond operator. Is it supposed to work for for the NDArray API? If so, then this is a bug. If not, then the documentation needs to be fixed since its not supported in the NDArray API. "},"comment":{"url":"https://api.github.com/repos/apache/incubator-mxnet/issues/comments/429958444","html_url":"https://github.com/apache/incubator-mxnet/issues/12825#issuecomment-429958444","issue_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12825","id":429958444,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTk1ODQ0NA==","user":{"login":"samskalicky","id":1541993,"node_id":"MDQ6VXNlcjE1NDE5OTM=","avatar_url":"https://avatars2.githubusercontent.com/u/1541993?v=4","gravatar_id":"","url":"https://api.github.com/users/samskalicky","html_url":"https://github.com/samskalicky","followers_url":"https://api.github.com/users/samskalicky/followers","following_url":"https://api.github.com/users/samskalicky/following{/other_user}","gists_url":"https://api.github.com/users/samskalicky/gists{/gist_id}","starred_url":"https://api.github.com/users/samskalicky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samskalicky/subscriptions","organizations_url":"https://api.github.com/users/samskalicky/orgs","repos_url":"https://api.github.com/users/samskalicky/repos","events_url":"https://api.github.com/users/samskalicky/events{/privacy}","received_events_url":"https://api.github.com/users/samskalicky/received_events","type":"User","site_admin":false},"created_at":"2018-10-15T18:14:07Z","updated_at":"2018-10-15T18:14:07Z","author_association":"CONTRIBUTOR","body":"@zheng-da What is your take on this? Is this supposed to work, or does the documentation need to be removed for cond (and other control flow operators) in the NDArray API?"}}
{"actor":{"display_login":"samskalicky"}}