Note-taking/Courses
-
Deep Neural Networks with PyTorch, COURSERANote-taking/Courses 2021. 1. 20. 09:02
1.1 Tensors 1D a = torch.tensor([0,1,2,3,4]) a.dtype -> torch.int64 a.type() -> torch.LongTensor a = torch.tensor([0., 1., 2., 3., 4.], dtype=torch.int32) a.dtype = torch.int32 a = torch.FloatTensor([0, 1, 2, 3, 4]) -> tensor([0., 1., 2., 3., 4.]) a = a.type(torch.FloatTensor) a.size() -> torch.Size(5) a.ndimension() -> 1 a_col = a.view(5, 1) = a.view(-1, 1) // .view(..) is the same as .reshape(..