{"action":"opened","issue":{"url":"https://api.github.com/repos/joschu/cgt/issues/58","labels_url":"https://api.github.com/repos/joschu/cgt/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/joschu/cgt/issues/58/comments","events_url":"https://api.github.com/repos/joschu/cgt/issues/58/events","html_url":"https://github.com/joschu/cgt/issues/58","id":115363656,"number":58,"title":"Random number generation and modules (and simplification again)","user":{"login":"sbos","id":120461,"avatar_url":"https://avatars.githubusercontent.com/u/120461?v=3","gravatar_id":"","url":"https://api.github.com/users/sbos","html_url":"https://github.com/sbos","followers_url":"https://api.github.com/users/sbos/followers","following_url":"https://api.github.com/users/sbos/following{/other_user}","gists_url":"https://api.github.com/users/sbos/gists{/gist_id}","starred_url":"https://api.github.com/users/sbos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbos/subscriptions","organizations_url":"https://api.github.com/users/sbos/orgs","repos_url":"https://api.github.com/users/sbos/repos","events_url":"https://api.github.com/users/sbos/events{/privacy}","received_events_url":"https://api.github.com/users/sbos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-05T20:08:48Z","updated_at":"2015-11-05T20:08:48Z","closed_at":null,"body":"It seems that there are still problems with simplification of random number generation operation if they are encapsulated into modules.\r\n\r\nThe following code prints two last lines equal when simplification is turned on:\r\n\r\n```python\r\nimport cgt\r\nimport cgt.nn as nn\r\n\r\nz1 = cgt.randn()\r\nz2 = cgt.randn()\r\n\r\nm = nn.Module([cgt.scalar()], [z1, z2])\r\nf = cgt.function([], m([0.]))\r\n\r\nprint 'A', f()\r\nprint 'A', f()\r\n\r\nz = cgt.randn(2)\r\nm = nn.Module([cgt.scalar()], [z])\r\n\r\nf = cgt.function([], m([0.]) + m([0.]))\r\n\r\nprint 'B', f()\r\nprint 'B', f()\r\n\r\n```"}}