torch.linspace() 生成等间距向量

torch.linspace(start, end, steps=100, out=None) 

参数:

start (float) - 区间的起始点

end (float) - 区间的终点

steps (int) - 在start和end间生成的样本数

import torch

a=torch.linspace(0,9,10)
print(a.shape)
# print(a)
b=a.repeat(10,1)
print(b.shape)
print(b)
c=a.repeat(2,2,1)
print(c.shape)
print(c)

猜你喜欢

转载自blog.csdn.net/qq_40107571/article/details/131504986
今日推荐