This repository was archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModel.py
More file actions
33 lines (25 loc) · 1.21 KB
/
Model.py
File metadata and controls
33 lines (25 loc) · 1.21 KB
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
32
33
import torch
import torch.nn as nn
class CustomModel(nn.Module):
def __init__(self):
super(CustomModel, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=1024, kernel_size=3, stride=1, padding=1, bias=False)
self.relu1 = nn.ReLU()
self.conv2 = nn.Conv2d(in_channels=1024, out_channels=1024, kernel_size=3, stride=1, padding=1, bias=False)
self.relu2 = nn.ReLU()
"""
self.conv3 = nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, bias=False)
self.relu3 = nn.ReLU()
self.conv4 = nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, bias=False)
self.relu4 = nn.ReLU()
self.conv5 = nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, bias=False)
self.relu5 = nn.ReLU()
"""
#self.subpixel = nn.PixelShuffle(2)
self.conv6 = nn.Conv2d(in_channels=1024, out_channels=3, kernel_size=3, stride=1, padding=1, bias=False)
def forward(self, x):
out = self.relu1(self.conv1(x))
out = self.relu2(self.conv2(out))
out = self.conv6(out)
out = torch.add(out, x)
return out