torch中view函數的用法

import torch
import numpy
x = torch.tensor(2,2,2)
t = x.view(1,8)#輸出數組的大小爲1*8
t = x.view(-1,4)#輸出數組的大小爲2*4, -1表示自行判斷
t = x.view(8)#輸出數組的大小爲8*1
t = x.view(-1)#輸出數組的大小爲1*8
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章