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

Method __init__

lib/Modules.py:76–82  ·  view source on GitHub ↗
(self, in_channels)

Source from the content-addressed store, hash-verified

74
75class PAM(nn.Module):
76 def __init__(self, in_channels):
77 super(PAM, self).__init__()
78 self.query_conv = nn.Conv2d(in_channels=in_channels, out_channels=in_channels // 4, kernel_size=1)
79 self.key_conv = nn.Conv2d(in_channels=in_channels, out_channels=in_channels // 4, kernel_size=1)
80 self.value_conv = nn.Conv2d(in_channels=in_channels, out_channels=in_channels, kernel_size=1)
81 self.gamma = nn.Parameter(torch.zeros(1))
82 self.softmax = nn.Softmax(dim=-1)
83
84 def forward(self, x):
85 m_batchsize, C, height, width = x.size()

Callers 15

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected