(inputs, filters, kernel, strides=None, dilation=None, name=None)
return conv(
        inputs=depthwise_conv,
        kernel=(1, 1),
        filters=int(filters * multiplier),
        strides=(1, 1),
        dilation=dilation,
        conv_param=pointwise_param,
        name='pointwise_' + name)
Separable convolution layer
Separable convolution layer
Separable convolution layer
def sep(inputs, filters, kernel, strides=None, dilation=None, name=None):
    """
        Separable convolution layer
    """
    if strides is None:
        strides = (1, 1)
    if dilation is None:
        dilation = (1, 1)
    if isinstance(kernel, (tuple, list)):
        n_depth = operator.mul(*kernel)
    else:
        n_depth = kernel * kernel
    n_point = inputs.shape[1]

    if isinstance(strides, (tuple, list)):
        multiplier = strides[0]
    else:
        multiplier = strides

    depthwise_param = fluid.param_attr.ParamAttr(
        initializer=fluid.initializer.TruncatedNormal(
            0.0, scale=np.sqrt(2.0 / n_depth)),
        regularizer=fluid.regularizer.L2Decay(FLAGS.weight_decay))

    pointwise_param = fluid.param_attr.ParamAttr(
        initializer=fluid.initializer.TruncatedNormal(
            0.0, scale=np.sqrt(2.0 / n_point)),
        regularizer=fluid.regularizer.L2Decay(FLAGS.weight_decay))

    depthwise_conv = conv(
        inputs=inputs,
        kernel=kernel,
        filters=int(filters * multiplier),
        strides=strides,
        dilation=dilation,
        num_groups=int(filters * multiplier),
        conv_param=depthwise_param,
        name='depthwise_' + name)

    return conv(
        inputs=depthwise_conv,
        kernel=(1, 1),
        filters=int(filters * multiplier),
        strides=(1, 1),
        dilation=dilation,
        conv_param=pointwise_param,
        name='pointwise_' + name)
def sep ( inputs , filters , kernel , strides = None , dilation = None , name = None ) : if strides is None : strides = ( 1 , 1 ) if dilation is None : dilation = ( 1 , 1 ) if isinstance ( kernel , ( tuple , list ) ) : n_depth = operator . mul ( * kernel ) else : n_depth = kernel * kernel n_point = inputs . shape [ 1 ] if isinstance ( strides , ( tuple , list ) ) : multiplier = strides [ 0 ] else : multiplier = strides depthwise_param = fluid . param_attr . ParamAttr ( initializer = fluid . initializer . TruncatedNormal ( 0.0 , scale = np . sqrt ( 2.0 / n_depth ) ) , regularizer = fluid . regularizer . L2Decay ( FLAGS . weight_decay ) ) pointwise_param = fluid . param_attr . ParamAttr ( initializer = fluid . initializer . TruncatedNormal ( 0.0 , scale = np . sqrt ( 2.0 / n_point ) ) , regularizer = fluid . regularizer . L2Decay ( FLAGS . weight_decay ) ) depthwise_conv = conv ( inputs = inputs , kernel = kernel , filters = int ( filters * multiplier ) , strides = strides , dilation = dilation , num_groups = int ( filters * multiplier ) , conv_param = depthwise_param , name = 'depthwise_' + name ) return conv ( inputs = depthwise_conv , kernel = ( 1 , 1 ) , filters = int ( filters * multiplier ) , strides = ( 1 , 1 ) , dilation = dilation , conv_param = pointwise_param , name = 'pointwise_' + name )