(self, stage_info)
return ret
skip last layer if channel_scale == 0
            use the same output channel if channel_scale < 0
skip last layer if channel_scale == 0
            use the same output channel if channel_scale < 0
skip last layer if channel_scale == 0 use the same output channel if channel_scale < 0
def add_last(self, stage_info):
        """ skip last layer if channel_scale == 0
            use the same output channel if channel_scale < 0
        """
        assert len(stage_info) == 2
        channels = stage_info[0]
        channel_scale = stage_info[1]

        if channel_scale == 0.0:
            return nn.Sequential()

        if channel_scale > 0:
            last_channel = (
                int(channels * self.width_ratio) if self.width_ratio > 1.0 else channels
            )
            last_channel = int(last_channel * channel_scale)
        else:
            last_channel = int(self.last_depth * (-channel_scale))
        last_channel = self._get_divisible_width(last_channel)

        if last_channel == 0:
            return nn.Sequential()

        dim_in = self.last_depth
        ret = ConvBNRelu(
            dim_in,
            last_channel,
            kernel=1,
            stride=1,
            pad=0,
            no_bias=1,
            use_relu="relu",
            bn_type=self.bn_type,
        )
        self.last_depth = last_channel
        return ret
def add_last ( self , stage_info ) : assert len ( stage_info ) == 2 channels = stage_info [ 0 ] channel_scale = stage_info [ 1 ] if channel_scale == 0.0 : return nn . Sequential ( ) if channel_scale > 0 : last_channel = ( int ( channels * self . width_ratio ) if self . width_ratio > 1.0 else channels ) last_channel = int ( last_channel * channel_scale ) else : last_channel = int ( self . last_depth * ( - channel_scale ) ) last_channel = self . _get_divisible_width ( last_channel ) if last_channel == 0 : return nn . Sequential ( ) dim_in = self . last_depth ret = ConvBNRelu ( dim_in , last_channel , kernel = 1 , stride = 1 , pad = 0 , no_bias = 1 , use_relu = "relu" , bn_type = self . bn_type , ) self . last_depth = last_channel return ret