From 8f0850997c8b98cdafdb67ddb1e9f07c8c07475b Mon Sep 17 00:00:00 2001 From: Marc Partensky Date: Fri, 30 Oct 2020 19:25:38 +0100 Subject: [PATCH] torch item --- learning-pytorch/tensor_tutorial.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/learning-pytorch/tensor_tutorial.py b/learning-pytorch/tensor_tutorial.py index af403f9..d0b6e9b 100755 --- a/learning-pytorch/tensor_tutorial.py +++ b/learning-pytorch/tensor_tutorial.py @@ -21,7 +21,14 @@ import torch # print(x[:, 1]) -x = torch.randn(4, 4) -y = x.view(16) -z = x.view(-1, 8) # the size -1 is inferred from other dimensions -print(x.size(), y.size(), z.size()) +# x = torch.randn(4, 4) +# y = x.view(16) +# z = x.view(-1, 8) # the size -1 is inferred from other dimensions +# print(x.size(), y.size(), z.size()) + +x = torch.randn(1) +print(x) +print(x.item()) + +a = torch.ones(5) +print(a)