Pytorch Added
This commit is contained in:
29
Pytorch/tensor/create_tensor.py
Normal file
29
Pytorch/tensor/create_tensor.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import torch
|
||||
|
||||
a = torch.tensor(([[[[0., 0., 0.],
|
||||
[0., 0., 0.]],
|
||||
|
||||
[[0., 1., 0.],
|
||||
[0., 0., 0.]]],
|
||||
|
||||
|
||||
[[[0., 2., 0.],
|
||||
[0., 0., 0.]],
|
||||
|
||||
[[0., 3., 0.],
|
||||
[0., 0., 0.]]]]))
|
||||
print(a)
|
||||
|
||||
b = torch.tensor([[3., 2., 1.], [1., 2., 3.]])
|
||||
c = torch.tensor([[1., 2., 3.], [4., 5., 6.]])
|
||||
|
||||
print(b)
|
||||
times = b * c
|
||||
print(times)
|
||||
print(times.type())
|
||||
|
||||
c = torch.normal(mean=1.0, std=torch.rand(5, 5))
|
||||
print(c)
|
||||
|
||||
d = torch.randperm(10)
|
||||
print(d)
|
Reference in New Issue
Block a user