tests/experimental/tensorflow/test_models/resnet.py
def make_divisible(value: float,
                   divisor: int,
                   min_value: Optional[float] = None,
                   round_down_protect: bool = True,
                   ) -> int:
    """This is to ensure that all layers have channels that are divisible by 8.

    Args:
        value: A `float` of original value.
        divisor: An `int` of the divisor that need to be checked upon.
        min_value: A `float` of  minimum value threshold.
        round_down_protect: A `bool` indicating whether round down more than 10%
            will be allowed.

    Returns:
        The adjusted value in `int` that is divisible against divisor.
    """
    if min_value is None:
        min_value = divisor
    new_value = max(min_value, int(value + divisor / 2) // divisor * divisor)
    # Make sure that round down does not go down by more than 10%.
    if round_down_protect and new_value < 0.9 * value:
        new_value += divisor
    return int(new_value)
This is to ensure that all layers have channels that are divisible by 8.

    Args:
        value: A `float` of original value.
        divisor: An `int` of the divisor that need to be checked upon.
        min_value: A `float` of  minimum value threshold.
        round_down_protect: A `bool` indicating whether round down more than 10%
            will be allowed.

    Returns:
        The adjusted value in `int` that is divisible against divisor.
    
This is to ensure that all layers have channels that are divisible by 8.
This is to ensure that all layers have channels that are divisible by 8 .
def make_divisible(value: float,
                   divisor: int,
                   min_value: Optional[float] = None,
                   round_down_protect: bool = True,
                   ) -> int:
    if min_value is None:
        min_value = divisor
    new_value = max(min_value, int(value + divisor / 2) // divisor * divisor)
    if round_down_protect and new_value < 0.9 * value:
        new_value += divisor
    return int(new_value)
def make_divisible ( value : float , divisor : int , min_value : Optional [ float ] = None , round_down_protect : bool = True , ) -> int : if min_value is None : min_value = divisor new_value = max ( min_value , int ( value + divisor / 2 ) // divisor * divisor ) if round_down_protect and new_value < 0.9 * value : new_value += divisor return int ( new_value )
This is to ensure that all layers have channels that are divisible by 8.
This is to ensure that all layers have channels that are divisible by 8 .
"""This is to ensure that all layers have channels that are divisible by 8.

    Args:
        value: A `float` of original value.
        divisor: An `int` of the divisor that need to be checked upon.
        min_value: A `float` of  minimum value threshold.
        round_down_protect: A `bool` indicating whether round down more than 10%
            will be allowed.

    Returns:
        The adjusted value in `int` that is divisible against divisor.
    """ # Make sure that round down does not go down by more than 10%.
The adjusted value in `int` that is divisible against divisor.
The adjusted value in ` int ` that is divisible against divisor .
value
float
A `float` of original value.
A ` float ` of original value .
divisor
int
An `int` of the divisor that need to be checked upon.
An ` int ` of the divisor that need to be checked upon .
min_value
Optional[float]
A `float` of  minimum value threshold.
A ` float ` of minimum value threshold .
round_down_protect
bool
A `bool` indicating whether round down more than 10%
will be allowed.
A ` bool ` indicating whether round down more than 10% will be allowed .