torch.unsqueeze()和torch.unsqueeze()
参考:torch.squeeze() 和torch.unsqueeze()用法的通俗解释
import torch
x = torch.tensor([[1, 2, 3],[1, 2, 3],[1, 2, 3]])
print(x)
print(torch.unsqueeze(x,0))
输出:
tensor([[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])
tensor([[[1, 2, 3],
[1, 2, 3],
[1, 2, 3]]])
版权声明:
作者:zhangchen
链接:https://www.techfm.club/p/13843.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。
THE END
二维码
共有 0 条评论