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

Method _round_width

slowfast/models/operators.py:39–58  ·  view source on GitHub ↗

Round width of filters based on width multiplier Args: width (int): the channel dimensions of the input. multiplier (float): the multiplication factor. min_width (int): the minimum width after multiplication. divisor (int): the new wid

(self, width, multiplier, min_width=8, divisor=8)

Source from the content-addressed store, hash-verified

37 """Squeeze-and-Excitation (SE) block w/ Swish: AvgPool, FC, Swish, FC, Sigmoid."""
38
39 def _round_width(self, width, multiplier, min_width=8, divisor=8):
40 """
41 Round width of filters based on width multiplier
42 Args:
43 width (int): the channel dimensions of the input.
44 multiplier (float): the multiplication factor.
45 min_width (int): the minimum width after multiplication.
46 divisor (int): the new width should be dividable by divisor.
47 """
48 if not multiplier:
49 return width
50
51 width *= multiplier
52 min_width = min_width or divisor
53 width_out = max(
54 min_width, int(width + divisor / 2) // divisor * divisor
55 )
56 if width_out < 0.9 * width:
57 width_out += divisor
58 return int(width_out)
59
60 def __init__(self, dim_in, ratio, relu_act=True):
61 """

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected