{"action":"created","issue":{"url":"https://api.github.com/repos/tbreloff/OpenAIGym.jl/issues/4","repository_url":"https://api.github.com/repos/tbreloff/OpenAIGym.jl","labels_url":"https://api.github.com/repos/tbreloff/OpenAIGym.jl/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/tbreloff/OpenAIGym.jl/issues/4/comments","events_url":"https://api.github.com/repos/tbreloff/OpenAIGym.jl/issues/4/events","html_url":"https://github.com/tbreloff/OpenAIGym.jl/issues/4","id":153563660,"number":4,"title":"Avoid shuffling underlying memory in observation","user":{"login":"dmrd","id":1198725,"avatar_url":"https://avatars.githubusercontent.com/u/1198725?v=3","gravatar_id":"","url":"https://api.github.com/users/dmrd","html_url":"https://github.com/dmrd","followers_url":"https://api.github.com/users/dmrd/followers","following_url":"https://api.github.com/users/dmrd/following{/other_user}","gists_url":"https://api.github.com/users/dmrd/gists{/gist_id}","starred_url":"https://api.github.com/users/dmrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmrd/subscriptions","organizations_url":"https://api.github.com/users/dmrd/orgs","repos_url":"https://api.github.com/users/dmrd/repos","events_url":"https://api.github.com/users/dmrd/events{/privacy}","received_events_url":"https://api.github.com/users/dmrd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-07T00:52:45Z","updated_at":"2016-05-07T09:56:34Z","closed_at":null,"body":"\r\n\r\nIn the Go environment, the moves are passed as a (3,9,9) array from the python side, and the underlying memory seems shuffled on the Julia side.  Probably want this to be a (9,9,3) array on the Julia side.\r\n\r\nNeed to find some way to reverse the dimensions and avoid modifying the memory every time [(e.g. the revdims option in PyCall master)](https://github.com/stevengj/PyCall.jl/blob/eb8d70a975689e71d0553ba7f29874cb41a8e870/src/numpy.jl#L183).  Unfortunately, this seems to only be going from the julia to numpy side\r\n\r\nCompare (notice python is 0000...1111, while julia is 001001001...):\r\n\r\n## Python\r\n\r\n```\r\nIn [71]: env = gym.make('Go9x9-v0')\r\n[2016-05-06 17:47:38,641] Making new env: Go9x9-v0\r\nInitializing Pachi engine uct with args threads=1,pondering=0\r\n\r\nIn [72]: env.reset().flatten()\r\nInitializing Pachi engine uct with args threads=1,pondering=0\r\nOut[72]:\r\narray([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n       0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r\n       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r\n       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r\n       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])\r\n```\r\n\r\n## Julia\r\n```\r\njulia> env = Env(\"Go9x9-v0\")\r\n[2016-05-06 17:48:15,540] Making new env: Go9x9-v0\r\nInitializing Pachi engine uct with args threads=1,pondering=0\r\nTo play: black\r\nMove:   0  Komi: 0.0  Handicap: 0  Captures B: 0 W: 0\r\n      A B C D E F G H J\r\n    +-------------------+\r\n  9 | . . . . . . . . . |\r\n  8 | . . . . . . . . . |\r\n  7 | . . . . . . . . . |\r\n  6 | . . . . . . . . . |\r\n  5 | . . . . . . . . . |\r\n  4 | . . . . . . . . . |\r\n  3 | . . . . . . . . . |\r\n  2 | . . . . . . . . . |\r\n  1 | . . . . . . . . . |\r\n    +-------------------+\r\n\r\njulia> reset(env).observation[:]\r\nInitializing Pachi engine uct with args threads=1,pondering=0\r\n243-element Array{Int64,1}:\r\n 0\r\n 0\r\n 1\r\n 0\r\n 0\r\n 1\r\n 0\r\n 0\r\n 1\r\n...\r\n```"},"comment":{"url":"https://api.github.com/repos/tbreloff/OpenAIGym.jl/issues/comments/217624650","html_url":"https://github.com/tbreloff/OpenAIGym.jl/issues/4#issuecomment-217624650","issue_url":"https://api.github.com/repos/tbreloff/OpenAIGym.jl/issues/4","id":217624650,"user":{"login":"dmrd","id":1198725,"avatar_url":"https://avatars.githubusercontent.com/u/1198725?v=3","gravatar_id":"","url":"https://api.github.com/users/dmrd","html_url":"https://github.com/dmrd","followers_url":"https://api.github.com/users/dmrd/followers","following_url":"https://api.github.com/users/dmrd/following{/other_user}","gists_url":"https://api.github.com/users/dmrd/gists{/gist_id}","starred_url":"https://api.github.com/users/dmrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmrd/subscriptions","organizations_url":"https://api.github.com/users/dmrd/orgs","repos_url":"https://api.github.com/users/dmrd/repos","events_url":"https://api.github.com/users/dmrd/events{/privacy}","received_events_url":"https://api.github.com/users/dmrd/received_events","type":"User","site_admin":false},"created_at":"2016-05-07T09:56:34Z","updated_at":"2016-05-07T09:56:34Z","body":"It's easy enough to reshuffle again on the Julia side.  It's more about avoiding overhead in the first place than convenience.\r\n\r\nGo has a small state space, so the overhead isn't huge, but for environments where the state is much larger (e.g. an image), the overhead could add up."}}