{"action":"created","issue":{"url":"https://api.github.com/repos/chainer/chainer/issues/5749","repository_url":"https://api.github.com/repos/chainer/chainer","labels_url":"https://api.github.com/repos/chainer/chainer/issues/5749/labels{/name}","comments_url":"https://api.github.com/repos/chainer/chainer/issues/5749/comments","events_url":"https://api.github.com/repos/chainer/chainer/issues/5749/events","html_url":"https://github.com/chainer/chainer/issues/5749","id":385703582,"node_id":"MDU6SXNzdWUzODU3MDM1ODI=","number":5749,"title":"When use multiprocessing can't backpropagation","user":{"login":"qby324","id":32825595,"node_id":"MDQ6VXNlcjMyODI1NTk1","avatar_url":"https://avatars0.githubusercontent.com/u/32825595?v=4","gravatar_id":"","url":"https://api.github.com/users/qby324","html_url":"https://github.com/qby324","followers_url":"https://api.github.com/users/qby324/followers","following_url":"https://api.github.com/users/qby324/following{/other_user}","gists_url":"https://api.github.com/users/qby324/gists{/gist_id}","starred_url":"https://api.github.com/users/qby324/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qby324/subscriptions","organizations_url":"https://api.github.com/users/qby324/orgs","repos_url":"https://api.github.com/users/qby324/repos","events_url":"https://api.github.com/users/qby324/events{/privacy}","received_events_url":"https://api.github.com/users/qby324/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-29T12:02:28Z","updated_at":"2018-11-30T06:09:49Z","closed_at":null,"author_association":"NONE","body":"It seems that Chainer does not play well with multiprocessing. Just a very simple example that when I use multiprocessing and can't backprop.\r\n\r\n```\r\nimport multiprocessing\r\nimport numpy as np\r\nimport chainer.links as L\r\n\r\nl=L.Linear(1,1)\r\na=ar([[1]],dtype=np.float32)\r\nl.cleargrads()\r\npool=multiprocessing.Pool(2)\r\ny=pool.apply_async(l,[a,]).get()\r\ny.backward()\r\nprint(str(l.W.grad))\r\n\r\n```\r\nThe result shows that l.W doesn't get the backpropagation result of output.\r\n"},"comment":{"url":"https://api.github.com/repos/chainer/chainer/issues/comments/443102087","html_url":"https://github.com/chainer/chainer/issues/5749#issuecomment-443102087","issue_url":"https://api.github.com/repos/chainer/chainer/issues/5749","id":443102087,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzEwMjA4Nw==","user":{"login":"fiarabbit","id":20432455,"node_id":"MDQ6VXNlcjIwNDMyNDU1","avatar_url":"https://avatars1.githubusercontent.com/u/20432455?v=4","gravatar_id":"","url":"https://api.github.com/users/fiarabbit","html_url":"https://github.com/fiarabbit","followers_url":"https://api.github.com/users/fiarabbit/followers","following_url":"https://api.github.com/users/fiarabbit/following{/other_user}","gists_url":"https://api.github.com/users/fiarabbit/gists{/gist_id}","starred_url":"https://api.github.com/users/fiarabbit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiarabbit/subscriptions","organizations_url":"https://api.github.com/users/fiarabbit/orgs","repos_url":"https://api.github.com/users/fiarabbit/repos","events_url":"https://api.github.com/users/fiarabbit/events{/privacy}","received_events_url":"https://api.github.com/users/fiarabbit/received_events","type":"User","site_admin":false},"created_at":"2018-11-30T06:09:49Z","updated_at":"2018-11-30T06:09:49Z","author_association":"CONTRIBUTOR","body":"I succeeded to reproduce the situation.\r\n\r\n```reproduction.py\r\nimport multiprocessing\r\nimport numpy as np\r\n\r\nfrom chainer import links as L\r\n\r\nl = L.Linear(1, 1, nobias=True, initialW=np.array([[1]]))\r\na = np.array([[1]], dtype=np.float32)\r\nl.cleargrads()\r\npool = multiprocessing.Pool(1)\r\ny_pool = pool.apply(l, (a, ))\r\ny_direct = l(a)\r\nprint(\"creator_node: \")\r\nprint(\"y_pool: {}\".format(y_pool.creator_node))\r\nprint(\"y_direct: {}\".format(y_direct.creator_node))\r\nprint(\"\")\r\n\r\ny_pool.backward()\r\nprint(\"l.W.grad:\")\r\nprint(\"y_pool.backward(): {}\".format(l.W.grad))\r\n\r\ny_direct.backward()\r\nprint(\"y_direct.backward(): {}\".format(l.W.grad))\r\n```\r\n\r\n```output.py\r\ncreator_node: \r\ny_pool: None\r\ny_direct: <chainer.functions.connection.linear.LinearFunction object at 0x2b801ec41978>\r\n\r\nl.W.grad:\r\ny_pool.backward(): None\r\ny_direct.backward(): [[1.]]\r\n```\r\n\r\nAs you can see, when using `Pool`, the `y.creator_node` is None.\r\n"}}
{"actor":{"display_login":"fiarabbit"}}