MCPcopy
hub / github.com/PaddlePaddle/PaddleOCR / __init__

Method __init__

ppocr/modeling/backbones/rec_svtrnet.py:369–401  ·  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

367
368class SubSample(nn.Layer):
369 def __init__(
370 self,
371 in_channels,
372 out_channels,
373 types="Pool",
374 stride=[2, 1],
375 sub_norm="nn.LayerNorm",
376 act=None,
377 ):
378 super().__init__()
379 self.types = types
380 if types == "Pool":
381 self.avgpool = nn.AvgPool2D(
382 kernel_size=[3, 5], stride=stride, padding=[1, 2]
383 )
384 self.maxpool = nn.MaxPool2D(
385 kernel_size=[3, 5], stride=stride, padding=[1, 2]
386 )
387 self.proj = nn.Linear(in_channels, out_channels)
388 else:
389 self.conv = nn.Conv2D(
390 in_channels,
391 out_channels,
392 kernel_size=3,
393 stride=stride,
394 padding=1,
395 weight_attr=ParamAttr(initializer=KaimingNormal()),
396 )
397 self.norm = eval(sub_norm)(out_channels)
398 if act is not None:
399 self.act = act()
400 else:
401 self.act = None
402
403 def forward(self, x):
404 if self.types == "Pool":

Callers

nothing calls this directly

Calls 2

evalFunction · 0.50
__init__Method · 0.45

Tested by

no test coverage detected