MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / ResidualBlock

Class ResidualBlock

lib/spvcnn_classsification.py:43–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42
43class ResidualBlock(nn.Module):
44 def __init__(self, inc, outc, ks=3, stride=1, dilation=1):
45 super().__init__()
46 self.net = nn.Sequential(
47 spnn.Conv3d(inc,
48 outc,
49 kernel_size=ks,
50 dilation=dilation,
51 stride=stride), spnn.BatchNorm(outc),
52 spnn.ReLU(True),
53 spnn.Conv3d(outc,
54 outc,
55 kernel_size=ks,
56 dilation=dilation,
57 stride=1),
58 spnn.BatchNorm(outc)
59 )
60
61 self.downsample = nn.Sequential() if (inc == outc and stride == 1) else \
62 nn.Sequential(
63 spnn.Conv3d(inc, outc, kernel_size=1, dilation=1, stride=stride),
64 spnn.BatchNorm(outc)
65 )
66
67 self.relu = spnn.ReLU(True)
68
69 def forward(self, x):
70 out = self.relu(self.net(x) + self.downsample(x))
71 return out
72
73
74class SPVCNN_CLASSIFICATION(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected