- torch.logspace(start, end, steps=100, base=10.0, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False)
- 功能: 创建对数均分的1维张量
- 注意事项:长度为steps,底为base
- start: 数列起始值
- end: 数列结束值
- steps: 数列长度
- base: 对数函数的底,默认为10
torch.logspace(start=0.1, end=1.0, steps=5)
tensor([ 1.2589, 2.1135, 3.5481, 5.9566, 10.0000])
10^0.1=1.2589
10^(0.1+(1-0.1)/4)=2.1135
10^(0.1+(1-0.1)/4*2)=3.5481
10^(0.1+(1-0.1)/4*3)=5.9566
10^(0.1+(1-0.1)/4*4)=10^1=10