>>> torch.arange(5)
tensor([ 0, 1, 2, 3, 4])
torch.arange(start=0, end, step=1, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) → Tensor
参数 | 描述 |
---|---|
start (Number) | |
end (Number) | |
step (Number) | |
out (Tensor, optional) | |
dtype (torch.dtype, optional) | |
layout (torch.layout, optional) | |
device (torch.device, optional) | |
requires_grad (bool, optional) |
参考:
https://pytorch.org/docs/stable/generated/torch.arange.html#torch.arange