MCPcopy Index your code
hub / github.com/NVIDIA/FastPhotoStyle / VGGEncoder

Class VGGEncoder

models.py:8–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7
8class VGGEncoder(nn.Module):
9 def __init__(self, level):
10 super(VGGEncoder, self).__init__()
11 self.level = level
12
13 # 224 x 224
14 self.conv0 = nn.Conv2d(3, 3, 1, 1, 0)
15
16 self.pad1_1 = nn.ReflectionPad2d((1, 1, 1, 1))
17 # 226 x 226
18 self.conv1_1 = nn.Conv2d(3, 64, 3, 1, 0)
19 self.relu1_1 = nn.ReLU(inplace=True)
20 # 224 x 224
21
22 if level < 2: return
23
24 self.pad1_2 = nn.ReflectionPad2d((1, 1, 1, 1))
25 self.conv1_2 = nn.Conv2d(64, 64, 3, 1, 0)
26 self.relu1_2 = nn.ReLU(inplace=True)
27 # 224 x 224
28 self.maxpool1 = nn.MaxPool2d(kernel_size=2, stride=2, return_indices=True)
29 # 112 x 112
30
31 self.pad2_1 = nn.ReflectionPad2d((1, 1, 1, 1))
32 self.conv2_1 = nn.Conv2d(64, 128, 3, 1, 0)
33 self.relu2_1 = nn.ReLU(inplace=True)
34 # 112 x 112
35
36 if level < 3: return
37
38 self.pad2_2 = nn.ReflectionPad2d((1, 1, 1, 1))
39 self.conv2_2 = nn.Conv2d(128, 128, 3, 1, 0)
40 self.relu2_2 = nn.ReLU(inplace=True)
41 # 112 x 112
42
43 self.maxpool2 = nn.MaxPool2d(kernel_size=2, stride=2, return_indices=True)
44 # 56 x 56
45
46 self.pad3_1 = nn.ReflectionPad2d((1, 1, 1, 1))
47 self.conv3_1 = nn.Conv2d(128, 256, 3, 1, 0)
48 self.relu3_1 = nn.ReLU(inplace=True)
49 # 56 x 56
50
51 if level < 4: return
52
53 self.pad3_2 = nn.ReflectionPad2d((1, 1, 1, 1))
54 self.conv3_2 = nn.Conv2d(256, 256, 3, 1, 0)
55 self.relu3_2 = nn.ReLU(inplace=True)
56 # 56 x 56
57
58 self.pad3_3 = nn.ReflectionPad2d((1, 1, 1, 1))
59 self.conv3_3 = nn.Conv2d(256, 256, 3, 1, 0)
60 self.relu3_3 = nn.ReLU(inplace=True)
61 # 56 x 56
62
63 self.pad3_4 = nn.ReflectionPad2d((1, 1, 1, 1))
64 self.conv3_4 = nn.Conv2d(256, 256, 3, 1, 0)
65 self.relu3_4 = nn.ReLU(inplace=True)

Callers 2

converter.pyFile · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected