MCPcopy Create free account
hub / github.com/dangf15/THLNet / __init__

Method __init__

nets/dfnet_block.py:194–210  ·  view source on GitHub ↗
(self, depth=5, in_channels=64)

Source from the content-addressed store, hash-verified

192
193class DenseBlock(nn.Module):
194 def __init__(self, depth=5, in_channels=64):
195 super(DenseBlock, self).__init__()
196 self.depth = depth
197 self.in_channels = in_channels
198 self.pad = nn.ConstantPad2d((1, 1, 1, 0), value=0.)
199 self.twidth = 2
200 self.kernel_size = (self.twidth, 3)
201 for i in range(self.depth):
202 dil = 2 ** i
203 pad_length = self.twidth + (dil - 1) * (self.twidth - 1) - 1
204 #print(pad_length)
205 setattr(self, 'pad{}'.format(i + 1), nn.ConstantPad2d((1, 1, pad_length , 0), value=0.))
206 setattr(self, 'conv{}'.format(i + 1),
207 nn.Conv2d(self.in_channels, self.in_channels, kernel_size=self.kernel_size,
208 dilation=(dil, 1)))
209 setattr(self, 'norm{}'.format(i + 1), InstantLayerNorm2d(self.in_channels))
210 setattr(self, 'prelu{}'.format(i + 1), nn.PReLU(self.in_channels))
211
212 def forward(self, x):
213 skip = x

Callers

nothing calls this directly

Calls 2

InstantLayerNorm2dClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected