Numpy | Tensor | |
---|---|---|
repeat | np.repeat(a,16,axis=1) | a.repeat(1,16) |
tile | np.tile(a,(2,2)) | b = a.expand(1,4)? c = a.view(-1, 1).repeat(1, 16).view(10, -1) |
transpose | img = np.transpose(img, (0, 3, 1, 2)) | a = a.permute(3,2,1,0) |
expand | np.expand_dims(x, axis=0) | torch.unsqueeze(x, 1) |
numpy tensor variable对应表
请作者喝一杯咖啡☕️