def round_width(width, multiplier, min_width=8, divisor=8, ceil=False):
    """
    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 width should be dividable by divisor.
        ceil ('bool'):
            If True, use ceiling as the rounding method.
    """
    if not multiplier:
        return width

    width *= multiplier
    min_width = min_width or divisor
    if ceil:
        width_out = max(min_width, int(math.ceil(width / divisor)) * divisor)
    else:
        width_out = max(min_width, int(width + divisor / 2) // divisor * divisor)
    if width_out < 0.9 * width:
        width_out += divisor
    return int(width_out)
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 width should be dividable by divisor.
ceil ('bool'):
If True, use ceiling as the rounding method.
towhee/models/utils/round_width.py