[PyTorch] - Tensor Manipulation
pytorch 2일차입니다. CNN, LSTM stock forecasting 코드 따라치는데 텐서 조작이 너무 어려워서 trensor manipulation 깔작대어 보려구요 Tensor Indexing import torch x = torch.tensor([[1,2],[3,4]]) print(x) print(x[0]) print(x[:,0] #output #tensor([[1,2], #[3,4]]) #tensor([1,2]) #tensor([1,3]) view argument로는 바뀔 shape이 주어짐. tensor값은 동일하지만, shape이 바뀐 새로운 tensor return x = torch.randn(3,5) a = x.view(15) b = x.view(5, -1) print(x.size..
2024. 4. 11.