MCPcopy Create free account
hub / github.com/buaacxf/VIPTR / PatchEmbed

Class PatchEmbed

modules/VIPTRv2.py:916–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

914 return x
915
916class PatchEmbed(nn.Module):
917 def __init__(self, in_chans=3, embed_dim=96, norm_layer=None):
918 super().__init__()
919
920 self.embed_dim = embed_dim
921 self.proj = nn.Sequential(
922 ConvBNLayer(
923 in_channels=in_chans,
924 out_channels=embed_dim // 2,
925 kernel_size=3,
926 stride=2,
927 padding=1,
928 act=nn.GELU,
929 bias_attr=False),
930 ConvBNLayer(
931 in_channels=embed_dim // 2,
932 out_channels=embed_dim,
933 kernel_size=3,
934 stride=2,
935 padding=1,
936 act=nn.GELU,
937 bias_attr=False)
938 )
939
940 def forward(self, x):
941 x = self.proj(x).permute(0, 2, 3, 1).contiguous()
942 return x
943
944
945class VIPTRNet(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected