MCPcopy Create free account
hub / github.com/ChunmingHe/WS-SAM / __init__

Method __init__

lib/Modules.py:689–699  ·  view source on GitHub ↗
(self, n_feat, kernel_size=3, reduction=16, bias=True, bn=False, act=nn.ReLU(True), res_scale=1)

Source from the content-addressed store, hash-verified

687 # input: B*C*H*W
688 # output: B*C*H*W
689 def __init__(self, n_feat, kernel_size=3, reduction=16, bias=True, bn=False, act=nn.ReLU(True), res_scale=1):
690
691 super(RCAB, self).__init__()
692 modules_body = []
693 for i in range(2):
694 modules_body.append(self.default_conv(n_feat, n_feat, kernel_size, bias=bias))
695 if bn: modules_body.append(nn.BatchNorm2d(n_feat))
696 if i == 0: modules_body.append(act)
697 modules_body.append(CALayer(n_feat, reduction))
698 self.body = nn.Sequential(*modules_body)
699 self.res_scale = res_scale
700
701 def default_conv(self, in_channels, out_channels, kernel_size, bias=True):
702 return nn.Conv2d(in_channels, out_channels, kernel_size, padding=(kernel_size // 2), bias=bias)

Callers

nothing calls this directly

Calls 3

default_convMethod · 0.95
CALayerClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected