torch item
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user