{"action":"created","issue":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/15301","repository_url":"https://api.github.com/repos/pytorch/pytorch","labels_url":"https://api.github.com/repos/pytorch/pytorch/issues/15301/labels{/name}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/15301/comments","events_url":"https://api.github.com/repos/pytorch/pytorch/issues/15301/events","html_url":"https://github.com/pytorch/pytorch/issues/15301","id":391727121,"node_id":"MDU6SXNzdWUzOTE3MjcxMjE=","number":15301,"title":"torch.meshgrid behaves differently with numpy.meshgrid ","user":{"login":"harryhan618","id":10130410,"node_id":"MDQ6VXNlcjEwMTMwNDEw","avatar_url":"https://avatars2.githubusercontent.com/u/10130410?v=4","gravatar_id":"","url":"https://api.github.com/users/harryhan618","html_url":"https://github.com/harryhan618","followers_url":"https://api.github.com/users/harryhan618/followers","following_url":"https://api.github.com/users/harryhan618/following{/other_user}","gists_url":"https://api.github.com/users/harryhan618/gists{/gist_id}","starred_url":"https://api.github.com/users/harryhan618/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harryhan618/subscriptions","organizations_url":"https://api.github.com/users/harryhan618/orgs","repos_url":"https://api.github.com/users/harryhan618/repos","events_url":"https://api.github.com/users/harryhan618/events{/privacy}","received_events_url":"https://api.github.com/users/harryhan618/received_events","type":"User","site_admin":false},"labels":[{"id":443483881,"node_id":"MDU6TGFiZWw0NDM0ODM4ODE=","url":"https://api.github.com/repos/pytorch/pytorch/labels/todo","name":"todo","color":"c2e0c6","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-17T14:05:10Z","updated_at":"2018-12-17T16:01:07Z","closed_at":null,"author_association":"NONE","body":"```\r\nimport torch\r\nimport numpy as npt\r\nx = torch.arange(3)\r\ny = torch.arange(10,14)\r\nprint(torch.meshgrid([x,y]))\r\nprint(np.meshgrid(x.numpy(), y.numpy()))\r\n```\r\n\r\nwhich gives:\r\n```\r\n(tensor([[0, 0, 0, 0],\r\n         [1, 1, 1, 1],\r\n         [2, 2, 2, 2]]), \r\n tensor([[10, 11, 12, 13],\r\n         [10, 11, 12, 13],\r\n         [10, 11, 12, 13]]))\r\n```\r\nand \r\n```\r\n[array([[0, 1, 2],\r\n        [0, 1, 2],\r\n        [0, 1, 2],\r\n        [0, 1, 2]]), \r\n array([[10, 10, 10],\r\n        [11, 11, 11],\r\n        [12, 12, 12],\r\n        [13, 13, 13]])]\r\n```\r\n\r\nI think numpy's behavior makes more sense, when I'm implementing object detection algorithm YOLO and trying to recover the bounding boxes from the offsets to the grids.\r\nAlso, this inconsistence will cause wrong results to those who don't check the pytorch behavior\r\n\r\nCorrect me if there is a better indention to implement like this. Thank you!\r\n\r\nPytorch version: 0.4.1.  I just download 1.0 and it behaves just the same as 0.4.1"},"comment":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/comments/447896979","html_url":"https://github.com/pytorch/pytorch/issues/15301#issuecomment-447896979","issue_url":"https://api.github.com/repos/pytorch/pytorch/issues/15301","id":447896979,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Nzg5Njk3OQ==","user":{"login":"fmassa","id":9110200,"node_id":"MDQ6VXNlcjkxMTAyMDA=","avatar_url":"https://avatars2.githubusercontent.com/u/9110200?v=4","gravatar_id":"","url":"https://api.github.com/users/fmassa","html_url":"https://github.com/fmassa","followers_url":"https://api.github.com/users/fmassa/followers","following_url":"https://api.github.com/users/fmassa/following{/other_user}","gists_url":"https://api.github.com/users/fmassa/gists{/gist_id}","starred_url":"https://api.github.com/users/fmassa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmassa/subscriptions","organizations_url":"https://api.github.com/users/fmassa/orgs","repos_url":"https://api.github.com/users/fmassa/repos","events_url":"https://api.github.com/users/fmassa/events{/privacy}","received_events_url":"https://api.github.com/users/fmassa/received_events","type":"User","site_admin":false},"created_at":"2018-12-17T16:01:07Z","updated_at":"2018-12-17T16:01:07Z","author_association":"MEMBER","body":"We might want to add the [`indexing` option to `meshgrid`, similarly to numpy](https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.meshgrid.html).\r\nThe current behavior of PyTorch meshgrid is `ij`, while numpy defaults to `xy`."}}
{"actor":{"display_login":"fmassa"}}