For this case,
tensor_input = torch.Tensor([[[[-0.6572, -0.0377, 0.2676, -0.2568, -1.6279, -0.3259, -0.1349,
-0.6699, 1.0273, 0.0203, -0.7080, 0.9360, 0.8535, 0.0132,
1.2920, -0.4414, -0.5073, -0.5352, 0.2313, 0.1196, -0.7681,
-0.9087, -0.4175, -0.0583, -1.1299, 1.5000, 0.0756, 0.4622,
-0.5273, 1.7432, -0.8896, 1.7295, -0.7310, -0.7080, -0.0253,
0.7202, 2.2656, 1.2324, 1.0000, 0.8584, -3.2207, 0.0425,
-1.3242, -0.0217, 0.2297, -0.3833, -0.0539, 1.2920, -0.6719,
0.3425, 1.4785, 0.6108, 0.5913, -1.3027, -1.0791]]]])
value_gpu, index_gpu = torch.mode(tensor_input.cuda(), -1, False)
value_cpu, index_cpu = torch.mode(tensor_input.cpu(), -1, False)
print("value_gpu is: ", value_gpu)
print("value_cpu is: ", value_cpu)
the running result is:
value_gpu is: tensor([[[1.2920]]], device='cuda:0')
value_cpu is: tensor([[[-0.7080]]])
For the input tensor, 1.2920 and -0.7080, both values above appear twice, why CPU return -0.7080, while GPU return 1.2920 ?
If all point values appear only once, CPU and GPU will return the minimum, why partial point value appear twice, CPU still return the minimum, while GPU will not return the minimum?
I wonder if this phenomenon is reasonable?