Different result using torch.mean cpu and cuda

Hi,
I am using pytorch 1.3 but found torch.mean get different result when using cpu and cuda
a = torch.ones(2,3,4)
a.mean([1,1])
If I give mean the same dim twice ,cpu will compute twice ,and cuda will only compute ones.
but I also notice cpu sum only compute once, if I give the same dim twice.
can anybody give me some help with this?

Don’t pass the same dim multiple times, that is an error. If you upgrade PyTorch you get an error

RuntimeError: dim 1 appears multiple times in the list of dims

So it wasn’t properly defined before, and now we explicitly check.

Best regards

Thomas

1 Like