上海创新网站建设,网站建设费支付请示,万江营销型网站建设,自助免费建网站AI学习目录汇总 
1、torch.arange 
返回一维张量(一维数组),官网说明,常见的三种用法如下 
输入:torch.arange(5)
输出:tensor([0, 1, 2, 3, 4])
输入:torch.arange(5, 16)
输出:tensor([ 5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15])
输入:torch.arange(1, 25, 2) 
…AI学习目录汇总 
1、torch.arange 
返回一维张量(一维数组),官网说明,常见的三种用法如下 
输入:torch.arange(5)
输出:tensor([0, 1, 2, 3, 4])
输入:torch.arange(5, 16)
输出:tensor([ 5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15])
输入:torch.arange(1, 25, 2) 
输出:tensor([ 1,  3,  5,  7,  9, 11, 13, 15, 17, 19, 21, 23])2、tensor.shape、tensor.reshape 
tensor.shape:查看张量的形状 tensor.reshape:返回改变形状后的张量,原张量不变 
输入:x=torch.arange(12)
输入:x
输出:tensor([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11])
输入:x.shape
输出:torch.Size([12])