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

Class PatchEmbed

modules/VIPTRv1.py:852–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

850
851
852class PatchEmbed(nn.Module):
853 def __init__(self, in_chans=3, embed_dim=96, norm_layer=None):
854 super().__init__()
855
856 self.embed_dim = embed_dim
857 self.proj = nn.Sequential(
858 ConvBNLayer(
859 in_channels=in_chans,
860 out_channels=embed_dim // 2,
861 kernel_size=3,
862 stride=2,
863 padding=1,
864 act=nn.GELU,
865 bias_attr=False),
866 ConvBNLayer(
867 in_channels=embed_dim // 2,
868 out_channels=embed_dim,
869 kernel_size=3,
870 stride=2,
871 padding=1,
872 act=nn.GELU,
873 bias_attr=False)
874 )
875
876 def forward(self, x):
877 x = self.proj(x).permute(0, 2, 3, 1).contiguous()
878 return x
879
880
881class VTPTRNet(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected