MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / __init__

Method __init__

slowfast/models/operators.py:60–76  ·  view source on GitHub ↗

Args: dim_in (int): the channel dimensions of the input. ratio (float): the channel reduction ratio for squeeze. relu_act (bool): whether to use ReLU activation instead of Swish (default). divisor (int): the new width should be

(self, dim_in, ratio, relu_act=True)

Source from the content-addressed store, hash-verified

58 return int(width_out)
59
60 def __init__(self, dim_in, ratio, relu_act=True):
61 """
62 Args:
63 dim_in (int): the channel dimensions of the input.
64 ratio (float): the channel reduction ratio for squeeze.
65 relu_act (bool): whether to use ReLU activation instead
66 of Swish (default).
67 divisor (int): the new width should be dividable by divisor.
68 """
69 super(SE, self).__init__()
70 self.avg_pool = nn.AdaptiveAvgPool3d((1, 1, 1))
71 dim_fc = self._round_width(dim_in, ratio)
72 self.fc1 = nn.Conv3d(dim_in, dim_fc, 1, bias=True)
73 self.fc1_act = nn.ReLU() if relu_act else Swish()
74 self.fc2 = nn.Conv3d(dim_fc, dim_in, 1, bias=True)
75
76 self.fc2_sig = nn.Sigmoid()
77
78 def forward(self, x):
79 x_in = x

Callers 1

__init__Method · 0.45

Calls 2

_round_widthMethod · 0.95
SwishClass · 0.85

Tested by

no test coverage detected