{"action":"closed","issue":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/12115","repository_url":"https://api.github.com/repos/pytorch/pytorch","labels_url":"https://api.github.com/repos/pytorch/pytorch/issues/12115/labels{/name}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/12115/comments","events_url":"https://api.github.com/repos/pytorch/pytorch/issues/12115/events","html_url":"https://github.com/pytorch/pytorch/issues/12115","id":364202599,"node_id":"MDU6SXNzdWUzNjQyMDI1OTk=","number":12115,"title":"[regression] .mean() for half tensors no longer gives correct result even if result is representable in fp16","user":{"login":"ngimel","id":15841449,"node_id":"MDQ6VXNlcjE1ODQxNDQ5","avatar_url":"https://avatars3.githubusercontent.com/u/15841449?v=4","gravatar_id":"","url":"https://api.github.com/users/ngimel","html_url":"https://github.com/ngimel","followers_url":"https://api.github.com/users/ngimel/followers","following_url":"https://api.github.com/users/ngimel/following{/other_user}","gists_url":"https://api.github.com/users/ngimel/gists{/gist_id}","starred_url":"https://api.github.com/users/ngimel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngimel/subscriptions","organizations_url":"https://api.github.com/users/ngimel/orgs","repos_url":"https://api.github.com/users/ngimel/repos","events_url":"https://api.github.com/users/ngimel/events{/privacy}","received_events_url":"https://api.github.com/users/ngimel/received_events","type":"User","site_admin":false},"labels":[{"id":424131847,"node_id":"MDU6TGFiZWw0MjQxMzE4NDc=","url":"https://api.github.com/repos/pytorch/pytorch/labels/bug","name":"bug","color":"b60205","default":true},{"id":443484050,"node_id":"MDU6TGFiZWw0NDM0ODQwNTA=","url":"https://api.github.com/repos/pytorch/pytorch/labels/medium%20priority","name":"medium priority","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-09-26T20:40:00Z","updated_at":"2018-12-29T14:02:32Z","closed_at":"2018-12-29T14:02:32Z","author_association":"CONTRIBUTOR","body":"```\r\nimport torch\r\nx = torch.ones(65520, device='cuda', dtype=torch.float16)\r\nx.mean()\r\n```\r\nused to produce `tensor(1., dtype=torch.float16, device='cuda:0')` around the end of May, now it is \r\n`tensor(nan, device='cuda:0', dtype=torch.float16)`\r\nTwo reasons: mean was moved to ATen and thus no longer uses fused THC kernels for this\r\nhttps://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/ReduceOps.cpp#L96-L109 (that alone would lead to result being `inf`), and long `numel` is apparently being cast to half somewhere in TensorIterator `div_`, thus leading to `nan` answer.\r\nOur fault for not adding the tests at the time @mruberry fixed it. "}}
{"actor":{"display_login":"fmassa"}}