From b4c1d17580777fcc5118efa26b230432c0221b6a Mon Sep 17 00:00:00 2001 From: Haonan Date: Thu, 26 Jan 2017 17:52:47 -0800 Subject: [PATCH] remove flip_layer --- .../paddle/trainer_config_helpers/layers.py | 41 ------------------- .../tests/layers_test_config.py | 3 +- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/python/paddle/trainer_config_helpers/layers.py b/python/paddle/trainer_config_helpers/layers.py index c506977ca4e..19f7ec31865 100755 --- a/python/paddle/trainer_config_helpers/layers.py +++ b/python/paddle/trainer_config_helpers/layers.py @@ -71,7 +71,6 @@ __all__ = [ 'bilinear_interp_layer', 'trans_layer', 'rotate_layer', - 'flip_layer', 'sum_to_one_norm_layer', 'get_output_layer', 'LayerType', @@ -1720,46 +1719,6 @@ def rotate_layer(input, height, name=None, layer_attr=None): size=l.config.size) -@wrap_name_default() -@layer_support() -def flip_layer(input, height, name=None, layer_attr=None): - """ - A layer for flipping the matrix w.r.t the matrix center. - It's essentially rotating the matrix twice. - Used for input as image or map. - - .. math:: - y(i,j) = x(M-i-1, N-j-1) - - where :math:`x` is (M x N) input, and :math:`y` is (M x N) output. - - The example usage is: - - .. code-block:: python - - flip = flip_layer(input=layer, - height=100) - - :param input: Input layer. - :type input: LayerOutput - :param height: The height of the sample matrix - :type height: int - :param name: Layer name. - :type name: basestring - :param layer_attr: extra layer attributes. - :type layer_attr: ExtraLayerAttribute. - :return: LayerOutput object. - :rtype: LayerOutput - """ - assert isinstance(input, LayerOutput) - return rotate_layer( - input=rotate_layer( - input=input, height=height), - height=height, - name=name, - layer_attr=layer_attr) - - @wrap_name_default() @layer_support() def cos_sim(a, b, scale=1, size=1, name=None, layer_attr=None): diff --git a/python/paddle/trainer_config_helpers/tests/layers_test_config.py b/python/paddle/trainer_config_helpers/tests/layers_test_config.py index 3d417a00601..1964e6f113e 100644 --- a/python/paddle/trainer_config_helpers/tests/layers_test_config.py +++ b/python/paddle/trainer_config_helpers/tests/layers_test_config.py @@ -40,7 +40,6 @@ assert z1.size > 0 y2 = fc_layer(input=y, size=15) z2 = rotate_layer(input=y2, height=5) -z3 = flip_layer(input=y2, height=3) cos1 = cos_sim(a=x1, b=y1) cos3 = cos_sim(a=x1, b=y2, size=3) @@ -48,7 +47,7 @@ cos3 = cos_sim(a=x1, b=y2, size=3) linear_comb = linear_comb_layer(weights=x1, vectors=y2, size=3) out = fc_layer( - input=[cos1, cos3, linear_comb, z, z1, z2, z3], + input=[cos1, cos3, linear_comb, z, z1, z2], size=num_classes, act=SoftmaxActivation()) -- GitLab