{"action":"created","issue":{"url":"https://api.github.com/repos/Theano/Theano/issues/2521","labels_url":"https://api.github.com/repos/Theano/Theano/issues/2521/labels{/name}","comments_url":"https://api.github.com/repos/Theano/Theano/issues/2521/comments","events_url":"https://api.github.com/repos/Theano/Theano/issues/2521/events","html_url":"https://github.com/Theano/Theano/pull/2521","id":58516508,"number":2521,"title":"[WIP] New optimization: useless incsubtensor alloc","user":{"login":"sisp","id":2206639,"avatar_url":"https://avatars.githubusercontent.com/u/2206639?v=3","gravatar_id":"","url":"https://api.github.com/users/sisp","html_url":"https://github.com/sisp","followers_url":"https://api.github.com/users/sisp/followers","following_url":"https://api.github.com/users/sisp/following{/other_user}","gists_url":"https://api.github.com/users/sisp/gists{/gist_id}","starred_url":"https://api.github.com/users/sisp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sisp/subscriptions","organizations_url":"https://api.github.com/users/sisp/orgs","repos_url":"https://api.github.com/users/sisp/repos","events_url":"https://api.github.com/users/sisp/events{/privacy}","received_events_url":"https://api.github.com/users/sisp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":29,"created_at":"2015-02-22T20:15:51Z","updated_at":"2015-04-21T14:37:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Theano/Theano/pulls/2521","html_url":"https://github.com/Theano/Theano/pull/2521","diff_url":"https://github.com/Theano/Theano/pull/2521.diff","patch_url":"https://github.com/Theano/Theano/pull/2521.patch"},"body":"I found a missing optimization when looking at the following graph:\r\n```\r\nW = T.vector('W')\r\ni = T.vector('i', dtype='int64')\r\nt = T.scalar('t')\r\nz = T.sqr(t - W[i].sum())\r\ng = theano.grad(z, W)\r\nf = theano.function([W, i, t], g)\r\ntheano.printing.pydotprint(f, 'graph.png', format='png')\r\n```\r\n![theano](https://cloud.githubusercontent.com/assets/2206639/6320145/0e34a248-bad7-11e4-8d8e-2fbbac0e0633.png)\r\nIn the picture, \"Alloc id=8\" is unnecessary because the broadcastable scalar resulting from the fused elementwise ops is simply repeated, but `IncSubtensor` and `AdvancedIncSubtensor1` can broadcast a scalar increment automatically. I added a new optimization that fixes this case.\r\n\r\nComments?"},"comment":{"url":"https://api.github.com/repos/Theano/Theano/issues/comments/94817366","html_url":"https://github.com/Theano/Theano/pull/2521#issuecomment-94817366","issue_url":"https://api.github.com/repos/Theano/Theano/issues/2521","id":94817366,"user":{"login":"nouiz","id":180987,"avatar_url":"https://avatars.githubusercontent.com/u/180987?v=3","gravatar_id":"","url":"https://api.github.com/users/nouiz","html_url":"https://github.com/nouiz","followers_url":"https://api.github.com/users/nouiz/followers","following_url":"https://api.github.com/users/nouiz/following{/other_user}","gists_url":"https://api.github.com/users/nouiz/gists{/gist_id}","starred_url":"https://api.github.com/users/nouiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nouiz/subscriptions","organizations_url":"https://api.github.com/users/nouiz/orgs","repos_url":"https://api.github.com/users/nouiz/repos","events_url":"https://api.github.com/users/nouiz/events{/privacy}","received_events_url":"https://api.github.com/users/nouiz/received_events","type":"User","site_admin":false},"created_at":"2015-04-21T14:37:48Z","updated_at":"2015-04-21T14:37:48Z","body":"All seem good to me. I'm running all the tests as the daily buildbot locally and when it pass, we can merge.\r\n\r\nthanks!"}}