区别:
torch.range包含end,类型为32位浮点型 torch.arange不包含end,类型为64位整型
代码:
import torch
y
=torch
.range(1,5)
print(y
,y
.dtype
)
y
=torch
.arange
(1,5)
print(y
,y
.dtype
)
结果:
tensor
([1., 2., 3., 4., 5.]) torch
.float32
tensor
([1, 2, 3, 4]) torch
.int64
转载请注明原文地址: https://lol.8miu.com/read-5288.html