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
相關文章
相關標籤/搜索