divyamakkar0
commited on
Commit
·
c8b5862
1
Parent(s):
9a6b33e
Upload model
Browse files
model.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c4956d1399d3b3712d17c57d45b400a2f0bba42669fcc4fb9634eb4d52986e16
|
3 |
+
size 1548
|
model.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nun
|
3 |
+
|
4 |
+
class SimpleModel(nun.Module):
|
5 |
+
def __init__(self):
|
6 |
+
super(SimpleModel, self).__init__()
|
7 |
+
self.linear = nun.Linear(10, 1)
|
8 |
+
def forward(self, x):
|
9 |
+
return self.linear(x)
|
10 |
+
|
11 |
+
|
12 |
+
model= SimpleModel()
|
13 |
+
model.linear
|
14 |
+
|
15 |
+
x = torch.randn(1, 10)
|
16 |
+
t1 = x.to(torch.float)
|
17 |
+
|
18 |
+
with torch.no_grad():
|
19 |
+
prediction = model(t1).tolist()
|
20 |
+
|
21 |
+
print(prediction)
|
22 |
+
|
23 |
+
model= SimpleModel()
|
24 |
+
torch.save(model.state_dict(),'model.pth')
|