g
y
7
7
7
7
摘要: 1.矩阵的转置 方法:t() a=torch.randint(1,10,[2,3]) print(a,'\n') print(a.t()) 输出结果 tensor([[2, 8, 2], [9, 2, 4]]) tensor([[2, 9], [8, 2], [2, 4]]) transpose(维 阅读全文
posted @ 2020-10-05 21:39 gy77 阅读(4955) 评论(0) 推荐(0) 编辑
摘要: 数据本身不发生改变,数据的访问方式发生了改变 1.维度的扩展 函数:unsqueeze() # a是一个4维的 a = torch.randn(4, 3, 28, 28) print('a.shape\n', a.shape) print('\n维度扩展(变成5维的):') print('第0维前加 阅读全文
posted @ 2020-10-05 19:56 gy77 阅读(2839) 评论(0) 推荐(0) 编辑