MCPcopy Create free account
hub / github.com/hzwer/ECCV2022-RIFE / ResBlock

Class ResBlock

model/oldmodel/RIFE_HD.py:37–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35 )
36
37class ResBlock(nn.Module):
38 def __init__(self, in_planes, out_planes, stride=2):
39 super(ResBlock, self).__init__()
40 if in_planes == out_planes and stride == 1:
41 self.conv0 = nn.Identity()
42 else:
43 self.conv0 = nn.Conv2d(in_planes, out_planes,
44 3, stride, 1, bias=False)
45 self.conv1 = conv(in_planes, out_planes, 3, stride, 1)
46 self.conv2 = conv_woact(out_planes, out_planes, 3, 1, 1)
47 self.relu1 = nn.PReLU(1)
48 self.relu2 = nn.PReLU(out_planes)
49 self.fc1 = nn.Conv2d(out_planes, 16, kernel_size=1, bias=False)
50 self.fc2 = nn.Conv2d(16, out_planes, kernel_size=1, bias=False)
51
52 def forward(self, x):
53 y = self.conv0(x)
54 x = self.conv1(x)
55 x = self.conv2(x)
56 w = x.mean(3, True).mean(2, True)
57 w = self.relu1(self.fc1(w))
58 w = torch.sigmoid(self.fc2(w))
59 x = self.relu2(x * w + y)
60 return x
61
62c = 32
63

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected