MCPcopy Create free account
hub / github.com/ImprintLab/Medical-SAM2 / forward

Method forward

sam2_train/modeling/memory_encoder.py:104–117  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

102 self.drop_path = DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
103
104 def forward(self, x):
105 input = x
106 x = self.dwconv(x)
107 x = self.norm(x)
108 x = x.permute(0, 2, 3, 1) # (N, C, H, W) -> (N, H, W, C)
109 x = self.pwconv1(x)
110 x = self.act(x)
111 x = self.pwconv2(x)
112 if self.gamma is not None:
113 x = self.gamma * x
114 x = x.permute(0, 3, 1, 2) # (N, H, W, C) -> (N, C, H, W)
115
116 x = input + self.drop_path(x)
117 return x
118
119
120class Fuser(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected