- 每日一题
- torch.linspace
- torch.narrow
- map(function, iterable, …)
- 看代码论文
- 上课
- 看力扣
https://blog.csdn.net/qq_40967961/article/details/120541350?spm=1001.2014.3001.5501
torch.linspacetorch.linspace(start, end, steps=100, out=None) → Tensor 返回一个1维张量,包含在区间start和end上均匀间隔的step个点 a = torch.linspace(0,10,steps=4) >>print(a) tensor([ 0.0000, 3.3333, 6.6667, 10.0000])torch.narrow
narrow(dimension, start, length) -> Tensor
>>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> x.narrow(0, 0, 2) tensor([[ 1, 2, 3], [ 4, 5, 6]]) >>> x.narrow(1, 1, 2) tensor([[ 2, 3], [ 5, 6], [ 8, 9]])map(function, iterable, …)
- 参数function: 传的是一个函数名,可以是python内置的,也可以是自定义的。
- 参数iterable :传的是一个可以迭代的对象,例如列表,元组,字符串…
- 将iterable中的每一个元素执行一遍function
map(lambda x: 0.23*(sigma**2)/(x**2), sigmas)
对sigmas中的每个元素执行lambda定义的函数。
看代码论文论文4.2部分对应代码中rhos 和sigmas的求解
上课 看力扣


