{"action":"created","issue":{"url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/45","labels_url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/45/comments","events_url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/45/events","html_url":"https://github.com/arrayfire/arrayfire-python/issues/45","id":116428594,"number":45,"title":"arrayfire.flat() creating a copy","user":{"login":"FilipeMaia","id":147838,"avatar_url":"https://avatars.githubusercontent.com/u/147838?v=3","gravatar_id":"","url":"https://api.github.com/users/FilipeMaia","html_url":"https://github.com/FilipeMaia","followers_url":"https://api.github.com/users/FilipeMaia/followers","following_url":"https://api.github.com/users/FilipeMaia/following{/other_user}","gists_url":"https://api.github.com/users/FilipeMaia/gists{/gist_id}","starred_url":"https://api.github.com/users/FilipeMaia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FilipeMaia/subscriptions","organizations_url":"https://api.github.com/users/FilipeMaia/orgs","repos_url":"https://api.github.com/users/FilipeMaia/repos","events_url":"https://api.github.com/users/FilipeMaia/events{/privacy}","received_events_url":"https://api.github.com/users/FilipeMaia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-11T21:49:34Z","updated_at":"2015-11-12T03:51:40Z","closed_at":null,"body":"```python\r\nimport arrayfire\r\na = arrayfire.randu(3,2)\r\na.device_ptr()\r\n>>> 30068441088\r\nb = a[:,:]\r\nb.device_ptr()\r\n>>> 30068441088 \r\n# all fine until this point\r\narrayfire.flat(b).device_ptr()\r\n>>> 30068442112\r\n# here's trouble!\r\n```\r\nUsing a one-dimensional array does not cause a copy. Calling `flat()` on `a` does not cause a copy. I'm not certain if this is a bug, but it's certainly surprising. Also it probably comes from arrayfire directly."},"comment":{"url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/comments/155989635","html_url":"https://github.com/arrayfire/arrayfire-python/issues/45#issuecomment-155989635","issue_url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/45","id":155989635,"user":{"login":"pavanky","id":364829,"avatar_url":"https://avatars.githubusercontent.com/u/364829?v=3","gravatar_id":"","url":"https://api.github.com/users/pavanky","html_url":"https://github.com/pavanky","followers_url":"https://api.github.com/users/pavanky/followers","following_url":"https://api.github.com/users/pavanky/following{/other_user}","gists_url":"https://api.github.com/users/pavanky/gists{/gist_id}","starred_url":"https://api.github.com/users/pavanky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavanky/subscriptions","organizations_url":"https://api.github.com/users/pavanky/orgs","repos_url":"https://api.github.com/users/pavanky/repos","events_url":"https://api.github.com/users/pavanky/events{/privacy}","received_events_url":"https://api.github.com/users/pavanky/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T03:51:40Z","updated_at":"2015-11-12T03:51:40Z","body":"Hmm. This does not seem to happen in C++ using the following code:\r\n\r\n```\r\n        array a = randu(5,5);\r\n        array b = a(span);\r\n        array c = flat(b);\r\n        printf(\"%p, %p, %p\\n\", a.device<float>(), b.device<float>(), c.device<float>());\r\n```"}}