摘要: 1 只由一个元素组成的张量称为一维张量 x=torch.tensor([3.0]) y=torch.tensor([2.0]) x+y,x-y,x*y,x/y,x**y (tensor([5.]), tensor([1.]), tensor([6.]), tensor([1.5000]), tens 阅读全文
posted @ 2021-12-27 15:37 cumtljz 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 数据操作 1.创建12个数的张量 import torch x=torch.arange(12) x tensor([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) x.shape #张量的大小 torch.Size([12]) 2.调用reshape函数可以改变张量 阅读全文
posted @ 2021-12-27 00:21 cumtljz 阅读(51) 评论(0) 推荐(0) 编辑