Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7b35173 commit 628c651Copy full SHA for 628c651
1 file changed
beginner_source/blitz/tensor_tutorial.py
@@ -79,6 +79,13 @@
79
80
print(x[:, 1])
81
82
+###############################################################
83
+# Resizing: If you want to resize/reshape tensor, you can use ``torch.view``:
84
+x = torch.randn(4, 4)
85
+y = x.view(16)
86
+z = x.view(-1, 8) # the size -1 is inferred from other dimensions
87
+print(x.size(), y.size(), z.size())
88
+
89
###############################################################
90
# **Read later:**
91
#
0 commit comments