MCPcopy Create free account
hub / github.com/geekcomputers/Python / __init__

Method __init__

ML/src/python/neuralforge/nn/convolution.py:141–164  ·  view source on GitHub ↗
(self, in_channels, out_channels, down=True)

Source from the content-addressed store, hash-verified

139
140class UNetBlock(nn.Module):
141 def __init__(self, in_channels, out_channels, down=True):
142 super().__init__()
143 self.down = down
144
145 if down:
146 self.conv = nn.Sequential(
147 nn.Conv2d(in_channels, out_channels, 3, padding=1),
148 nn.BatchNorm2d(out_channels),
149 nn.ReLU(inplace=True),
150 nn.Conv2d(out_channels, out_channels, 3, padding=1),
151 nn.BatchNorm2d(out_channels),
152 nn.ReLU(inplace=True)
153 )
154 self.pool = nn.MaxPool2d(2)
155 else:
156 self.conv = nn.Sequential(
157 nn.Conv2d(in_channels, out_channels, 3, padding=1),
158 nn.BatchNorm2d(out_channels),
159 nn.ReLU(inplace=True),
160 nn.Conv2d(out_channels, out_channels, 3, padding=1),
161 nn.BatchNorm2d(out_channels),
162 nn.ReLU(inplace=True)
163 )
164 self.up = nn.ConvTranspose2d(in_channels, in_channels // 2, 2, stride=2)
165
166 def forward(self, x, skip=None):
167 if self.down:

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected