pytorch 關於[..., n]

input = torch.randn(1, 3, 28, 36)
print(input.size())
print(input[..., 0].shape)
print(input[..., 1].shape)
print(input[..., 2].shape)
print(input[..., 3].shape)
print(input[..., 4].shape)
print(input[..., 5].shape)

結果:
torch.Size([1, 3, 28, 36])
torch.Size([1, 3, 28])
torch.Size([1, 3, 28])
torch.Size([1, 3, 28])
torch.Size([1, 3, 28])
torch.Size([1, 3, 28])
torch.Size([1, 3, 28])

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章