其他分享
首页 > 其他分享> > 函数返回列表

函数返回列表

作者:互联网

def a():     w=torch.randn((5,1))     b=torch.randn(1)     return [w,b] return 函数返回的是一个列表。 代码展示: def a():     w=torch.randn((5,1))     b=torch.randn(1)     return [w,b] print(a())  

[tensor([[-1.2416],
[-0.0185],
[-1.2681],
[ 0.8797],
[-0.8969]]), tensor([-1.3992])]

由此可知输出的是一个列表。

标签:返回,return,函数,torch,列表,randn,def,tensor
来源: https://www.cnblogs.com/hahaah/p/14916153.html