MCPcopy Create free account
hub / github.com/drinkingcoder/NeuralMarker / forward

Method forward

core/encoders.py:80–97  ·  view source on GitHub ↗
(self, x, data=None, layer=2)

Source from the content-addressed store, hash-verified

78 self.svt = timm.create_model('twins_svt_large_context', pretrained=pretrained)
79
80 def forward(self, x, data=None, layer=2):
81 B = x.shape[0]
82 for i, (embed, drop, blocks, pos_blk) in enumerate(
83 zip(self.svt.patch_embeds, self.svt.pos_drops, self.svt.blocks, self.svt.pos_block)):
84
85 x, size = embed(x)
86 x = drop(x)
87 for j, blk in enumerate(blocks):
88 x = blk(x, size)
89 if j==0:
90 x = pos_blk(x, size)
91 if i < len(self.svt.depths) - 1:
92 x = x.reshape(B, *size, -1).permute(0, 3, 1, 2).contiguous()
93
94 if i == layer-1:
95 break
96
97 return x
98
99
100if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected