-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvCycle.py
39 lines (24 loc) · 887 Bytes
/
vCycle.py
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
34
35
36
37
38
from modules import *
class Cyclic(nn.Module):
def __init__(self):
super(Cyclic, self).__init__()
nChannel = 3
nFeat2 = 48
nFeat = 64
self.loops = 10
self.anal0 = Analysis(nChannel, nFeat, k= 3, str = 1)
self.anal2 = Analysis(nChannel, nFeat2, k = 3, str= 1)
self.synth2 = Sysnthesis(nChannel, nFeat2, 3)
self.blocks = nn.ModuleList()
for i in range(self.loops):
self.blocks.append(block2(nFeat, nFeat2, 3))
def forward(self, x):
x = ((x * 2) - 1)
x2 = nn.functional.interpolate(x, scale_factor= 2, mode='bicubic', align_corners=False)
a = self.anal0(x)
a0 = a
a2 = self.anal2(x2)
for i in range(self.loops):
a0, a2, fs = self.blocks[i](a0, a2)
SR0 = (self.synth2(a2) + 1) / 2
return SR0