Torch.ge not producing reasonable result with torch.int tensor

It seems that when using torch.ge on a torch.int tensor, the result is not reasonable.
What’s the reason?

Pytorch version: 0.4.0
Host: Ubuntu 16.04
Python: Anaconda

Test code:

import torch
import numpy as np

# Create a torch.int tensor from numpy
a_np = np.asarray([0, 1, 1, 0, 0])
a = torch.from_numpy(a_np)

# Create a torch.float tensor directly
b = torch.FloatTensor([0, 1, 1, 0, 0])

# Perform torch.ge on a and b
print(torch.ge(a, 0.5))   # Output: tensor([ 1,  1,  1,  1,  1], dtype=torch.uint8)
print(torch.ge(b, 0.5))   # Output: tensor([ 0,  1,  1,  0,  0], dtype=torch.uint8)

The workaround is to call a.float() after torch.from_numpy(.), then it performs exactly like the case with b.

Likely we convert the scalar to the dtype of the tensor somewhere in the calling path, then 0.5 becomes 0. Please file a bug report / feature request to github.com/pytorch/pytorch.

Thank you for the response. Bug reported here.