-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathendecoder.py
More file actions
32 lines (27 loc) · 799 Bytes
/
Copy pathendecoder.py
File metadata and controls
32 lines (27 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import torch.nn as nn
import torch
class decoder(nn.Module):
def __init__(self):
super(decoder, self).__init__()
self.fc = nn.Sequential(
nn.Linear(100,588),
nn.ReLU(True)
)
self.up=nn.Sequential(
nn.Conv2d(3,16,kernel_size=3,stride=1,padding=1),
nn.ReLU(),
nn.Conv2d(16,16,3,stride=1,padding=1),
nn.ReLU(),
nn.Upsample(scale_factor=2),
nn.Conv2d(16, 16, kernel_size=3, stride=1, padding=1),
nn.ReLU(True),
)
self.out = nn.Conv2d(16,3,1)
def forward(self, x):
out = self.fc(x)
out = out.view(-1,3,14,14)
out = self.up(out)
out = self.out(out)
return out
if __name__ == '__main__':
pass