def _resample_with_alpha(self, inputs, input_width, input_block_fn, target_width, target_num_filters, target_block_fn, alpha=0.5):
    'Match resolution and feature dimension.'
    (_, _, _, input_num_filters) = inputs.get_shape().as_list()
    if (input_block_fn == 'bottleneck'):
        input_num_filters /= 4
    new_num_filters = int((input_num_filters * alpha))
    x = layers.Conv2D(filters=new_num_filters, kernel_size=1, strides=1, use_bias=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer)(inputs)
    x = self._norm(axis=self._bn_axis, momentum=self._norm_momentum, epsilon=self._norm_epsilon)(x)
    x = tf_utils.get_activation(self._activation_fn)(x)
    if (input_width > target_width):
        x = layers.Conv2D(filters=new_num_filters, kernel_size=3, strides=2, padding='SAME', use_bias=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer)(x)
        x = self._norm(axis=self._bn_axis, momentum=self._norm_momentum, epsilon=self._norm_epsilon)(x)
        x = tf_utils.get_activation(self._activation_fn)(x)
        input_width /= 2
        while (input_width > target_width):
            x = layers.MaxPool2D(pool_size=3, strides=2, padding='SAME')(x)
            input_width /= 2
    elif (input_width < target_width):
        scale = (target_width // input_width)
        x = spatial_transform_ops.nearest_upsampling(x, scale=scale)
    if (target_block_fn == 'bottleneck'):
        target_num_filters *= 4
    x = layers.Conv2D(filters=target_num_filters, kernel_size=1, strides=1, use_bias=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer)(x)
    x = self._norm(axis=self._bn_axis, momentum=self._norm_momentum, epsilon=self._norm_epsilon)(x)
    return x
Match resolution and feature dimension.
def _resample_with_alpha(self, inputs, input_width, input_block_fn, target_width, target_num_filters, target_block_fn, alpha=0.5):
    
    (_, _, _, input_num_filters) = inputs.get_shape().as_list()
    if (input_block_fn == 'bottleneck'):
        input_num_filters /= 4
    new_num_filters = int((input_num_filters * alpha))
    x = layers.Conv2D(filters=new_num_filters, kernel_size=1, strides=1, use_bias=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer)(inputs)
    x = self._norm(axis=self._bn_axis, momentum=self._norm_momentum, epsilon=self._norm_epsilon)(x)
    x = tf_utils.get_activation(self._activation_fn)(x)
    if (input_width > target_width):
        x = layers.Conv2D(filters=new_num_filters, kernel_size=3, strides=2, padding='SAME', use_bias=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer)(x)
        x = self._norm(axis=self._bn_axis, momentum=self._norm_momentum, epsilon=self._norm_epsilon)(x)
        x = tf_utils.get_activation(self._activation_fn)(x)
        input_width /= 2
        while (input_width > target_width):
            x = layers.MaxPool2D(pool_size=3, strides=2, padding='SAME')(x)
            input_width /= 2
    elif (input_width < target_width):
        scale = (target_width // input_width)
        x = spatial_transform_ops.nearest_upsampling(x, scale=scale)
    if (target_block_fn == 'bottleneck'):
        target_num_filters *= 4
    x = layers.Conv2D(filters=target_num_filters, kernel_size=1, strides=1, use_bias=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer)(x)
    x = self._norm(axis=self._bn_axis, momentum=self._norm_momentum, epsilon=self._norm_epsilon)(x)
    return x