torch_arange() inconsistent with PyTorch
lawremi opened this issue · 0 comments
lawremi commented
There are at least a couple inconsistencies with torch.arange()
.
In PyTorch:
- Passing a
start
value without anend
value generates the range[0, start)
. That is convenient in the same way thatseq(x)
is convenient. - Passing all integer values for
start
,end
andstep
(which should default to1L
in R, not1
) yields an int64 tensor, not a float tensor, unless overridden bydtype
. In principle, R torch could be even smarter, and infer that arguments are meant to be integer (likeseq()
does), but having it work for formal integers would be a great start.
In other words, it would be nice if these were TRUE
:
identical(torch_arange(5L), torch_arange(0L, 4L))
identical(torch_arange(0L, 4L), torch_arange(0, 4, dtype = torch_int64()))