Hi,
I saw this in code:
coors = coors.int()
and coors is a tensor, whose shape is [1515,4].
I have googled the init function but found nothing.
Anybody know this function?
Hi,
I saw this in code:
coors = coors.int()
and coors is a tensor, whose shape is [1515,4].
I have googled the init function but found nothing.
Anybody know this function?
Based on your code snippet it seems you are looking for the int()
operator, not init()
.
If that’s the case: the int()
operation will return a tensor transformed to the int32
data type:
x = torch.randn(10) * 10
print(x)
> tensor([ 2.9199, -13.7902, -0.3769, -11.2643, -2.8111, -0.7583, -2.9747,
12.1106, -2.1383, 6.7038])
y = x.int()
print(y)
> tensor([ 2, -13, 0, -11, -2, 0, -2, 12, -2, 6], dtype=torch.int32)
OMG! I mistook it as init! So stupid