天天看點

nn.Upsample對不同次元tensor上采樣

torch中,
              我現在想把一個緯度為[bs, channel, depth, height, width]的3D tensor
通過nn.Upsample轉換為
                 [bs, channel, depth, height*2, width*2]的tensor           

則,init定義上采樣是應為:

self.upsacle = nn.Upsample(scale_factor=tuple([1,2,2]))
           

2D及其他緯度以此類推。

參考:

https://blog.csdn.net/yangwangnndd/article/details/95490074

繼續閱讀