结果是会包含end的,创建的tensor的类型为float32。
torch.arange(start=1, end=6)结果并不包含end,创建的tensor的类型为int64。
代码>>> y=torch.range(1,6) >>> y tensor([1., 2., 3., 4., 5., 6.]) >>> y.dtype torch.float32 >>> z=torch.arange(1,6) >>> z tensor([1, 2, 3, 4, 5]) >>> z.dtype torch.int64



