摘要:
▪ View/reshape(这个是维度的变化) ▪ Squeeze/unsqueeze(维度的增加/减少) ▪ Transpose/t/permute(维度交换) ▪ Expand/repeat(维度的扩展) # view/reshape 这两个API,都是通用的a.reshape()和a.vie 阅读全文
posted @ 2023-07-30 19:01
lipu123
阅读(98)
评论(0)
推荐(0)
摘要:
# indexing ``` a=torch.randn(4,3,28,28) a[0].shape # torch.Size([3, 28, 28]) a[0,0].shape # torch.Size([28, 28]) a[0,0,2,4] # tensor(0.6574) ``` # sel 阅读全文
posted @ 2023-07-30 16:15
lipu123
阅读(38)
评论(0)
推荐(0)
摘要:
# Import from numpy >torch.from_numpy(data) ``` a=np.array([2,3.3]) a #array([2. , 3.3]) torch.from_numpy(a) #tensor([2.0000, 3.3000], dtype=torch.flo 阅读全文
posted @ 2023-07-30 10:51
lipu123
阅读(25)
评论(0)
推荐(0)