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

Method __init__

modules/SVTR.py:342–369  ·  view source on GitHub ↗
(self,
                 in_channels,
                 out_channels,
                 types='Pool',
                 stride=[2, 1],
                 sub_norm='nn.LayerNorm',
                 act=None)

Source from the content-addressed store, hash-verified

340
341class SubSample(nn.Module):
342 def __init__(self,
343 in_channels,
344 out_channels,
345 types='Pool',
346 stride=[2, 1],
347 sub_norm='nn.LayerNorm',
348 act=None):
349 super().__init__()
350 self.types = types
351 if types == 'Pool':
352 self.avgpool = nn.AvgPool2d(
353 kernel_size=[3, 5], stride=stride, padding=[1, 2])
354 self.maxpool = nn.MaxPool2d(
355 kernel_size=[3, 5], stride=stride, padding=[1, 2])
356 self.proj = nn.Linear(in_channels, out_channels)
357 else:
358 self.conv = nn.Conv2d(
359 in_channels,
360 out_channels,
361 kernel_size=3,
362 stride=stride,
363 padding=1)
364
365 self.norm = eval(sub_norm)(out_channels)
366 if act is not None:
367 self.act = act()
368 else:
369 self.act = None
370
371 def forward(self, x):
372

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected