KEMBAR78
torch.norm on CPU gives incorrect results for large Tensors · Issue #15602 · pytorch/pytorch · GitHub
Skip to content

torch.norm on CPU gives incorrect results for large Tensors #15602

@soumith

Description

@soumith

🐛 Bug

>>> import torch
>>> x = torch.ones(40000)
>>> torch.norm(x)
tensor(266.0605)
>>> torch.norm(x.to(dtype=torch.float32, device='cuda'))
tensor(200., device='cuda:0')

Originally reported at https://discuss.pytorch.org/t/output-of-torch-norm-x-depends-on-size-of-x-not-in-a-good-way/33299/8

Metadata

Metadata

Assignees

Labels

cherry-pickedThis PR was cherry-picked onto a release branch from masterhigh priority

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions