array + python range
>>> torch.arange(5) tensor([ 0, 1, 2, 3, 4]) >>> torch.arange(1, 4) tensor([ 1, 2, 3]) >>> torch.arange(1, 2.5, 0.5) tensor([ 1.0000, 1.5000, 2.0000])
torch.arange — PyTorch 2.2 documentation
Returns a 1-D tensor of size ⌈end−startstep⌉\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil⌈stepend−start⌉
with values from the interval [start, end) taken with common difference
step beginning from start.
https://pytorch.org/docs/stable/generated/torch.arange.html

Seonglae Cho