How to use the x2paddle.op_mapper.caffe_custom_layer.register.register function in x2paddle

To help you get started, we’ve selected a few x2paddle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PaddlePaddle / X2Paddle / x2paddle / op_mapper / caffe_custom_layer / shufflechannel.py View on Github external
def shufflechannel_shape(input_shape):
    return input_shape


def shufflechannel_layer(inputs, group=None, input_shape=None, name=None):
    input = inputs[0]
    out = fluid.layers.shuffle_channel(x=input, group=group)
    return out


def shufflechannel_weights(name, data=None):
    weights_name = []
    return weights_name


register(kind='ShuffleChannel',
         shape=shufflechannel_shape,
         layer=shufflechannel_layer,
         weights=shufflechannel_weights)
github PaddlePaddle / X2Paddle / x2paddle / op_mapper / caffe_custom_layer / priorbox.py View on Github external
steps=steps,
                                            offset=offset,
                                            name=name,
                                            min_max_aspect_ratios_order=True)
    box = fluid.layers.reshape(box, [1, 1, -1])
    variance_ = fluid.layers.reshape(variance_, [1, 1, -1])
    out = fluid.layers.concat([box, variance_], axis=1)
    return out


def priorbox_weights(name, data=None):
    weights_name = []
    return weights_name


register(kind='PriorBox',
         shape=priorbox_shape,
         layer=priorbox_layer,
         weights=priorbox_weights)
github PaddlePaddle / X2Paddle / x2paddle / op_mapper / caffe_custom_layer / detectionoutput.py View on Github external
prior_box_var=pbv,
        background_label=background_label_id,
        nms_threshold=nms_param["nms_threshold"],
        nms_top_k=nms_param["top_k"],
        keep_top_k=keep_top_k,
        score_threshold=confidence_threshold,
        nms_eta=nms_param["eta"])
    return out


def detectionoutput_weights(name, data=None):
    weights_name = []
    return weights_name


register(kind='DetectionOutput',
         shape=detectionoutput_shape,
         layer=detectionoutput_layer,
         weights=detectionoutput_weights)
github PaddlePaddle / X2Paddle / x2paddle / op_mapper / caffe_custom_layer / normalize.py View on Github external
dtype=input.dtype,
        attr=name + '_scale')
    scale_param = fluid.layers.reshape(x=scale_param, \
                  shape=[1] if channel_shared else [input_shape[0][0], 1, 1, input_shape[0][1]])
    out = fluid.layers.elementwise_mul(x=l2_norm,
                                       y=scale_param,
                                       axis=-1 if channel_shared else 1)
    return out


def normalize_weights(name, data=None):
    weights_name = [name + '_scale']
    return weights_name


register(kind='Normalize',
         shape=normalize_shape,
         layer=normalize_layer,
         weights=normalize_weights)
github PaddlePaddle / X2Paddle / x2paddle / op_mapper / caffe_custom_layer / convolutiondepthwise.py View on Github external
groups=group,
                              num_filters=c_out,
                              param_attr=name + '_weights',
                              bias_attr=name + '_bias',
                              name=name)
    return out


def convolutiondepthwise_weights(name, data=None):
    weights_name = []
    weights_name.append(name + '_weights')
    weights_name.append(name + '_bias')
    return weights_name


register(kind='ConvolutionDepthwise',
         shape=convolutiondepthwise_shape,
         layer=convolutiondepthwise_layer,
         weights=convolutiondepthwise_weights)