From 7613918e23d2d867a53060128636d7d46f9f459a Mon Sep 17 00:00:00 2001 From: ceci3 <592712189@qq.com> Date: Wed, 6 Mar 2019 10:44:56 +0000 Subject: [PATCH] test=develop, change labels name --- paddle/fluid/API.spec | 2 +- .../fluid/tests/unittests/test_npair_loss_op.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index 819a76e16..7cdbd1f1e 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -144,7 +144,7 @@ paddle.fluid.layers.label_smooth (ArgSpec(args=['label', 'prior_dist', 'epsilon' paddle.fluid.layers.roi_pool (ArgSpec(args=['input', 'rois', 'pooled_height', 'pooled_width', 'spatial_scale'], varargs=None, keywords=None, defaults=(1, 1, 1.0)), ('document', 'c317aa595deb31649083c8faa91cdb97')) paddle.fluid.layers.roi_align (ArgSpec(args=['input', 'rois', 'pooled_height', 'pooled_width', 'spatial_scale', 'sampling_ratio', 'name'], varargs=None, keywords=None, defaults=(1, 1, 1.0, -1, None)), ('document', '12c5bbb8b38c42e623fbc47611d766e1')) paddle.fluid.layers.dice_loss (ArgSpec(args=['input', 'label', 'epsilon'], varargs=None, keywords=None, defaults=(1e-05,)), ('document', '1ba0508d573f65feecf3564dce22aa1d')) -paddle.fluid.layers.image_resize (ArgSpec(args=['input', 'out_shape', 'scale', 'name', 'resample', 'actual_shape', 'align_corners', 'align_mode'], varargs=None, keywords=None, defaults=(None, None, None, 'BILINEAR', None, True, 1)), ('document', 'b3ecb819454832885c1f0f3ab9a5b938')) +paddle.fluid.layers.image_resize (ArgSpec(args=['input', 'out_shape', 'scale', 'name', 'resample', 'actual_shape', 'align_corners', 'align_mode'], varargs=None, keywords=None, defaults=(None, None, None, 'BILINEAR', None, True, 1)), ('document', '7a1966d7c3a48f1fc0881cdaf5d83b0b')) paddle.fluid.layers.image_resize_short (ArgSpec(args=['input', 'out_short_len', 'resample'], varargs=None, keywords=None, defaults=('BILINEAR',)), ('document', '06211aefc50c5a3e940d7204d859cdf7')) paddle.fluid.layers.resize_bilinear (ArgSpec(args=['input', 'out_shape', 'scale', 'name', 'actual_shape', 'align_corners', 'align_mode'], varargs=None, keywords=None, defaults=(None, None, None, None, True, 1)), ('document', 'e4fb4ed511b2293b8f04f7e872afbfd7')) paddle.fluid.layers.resize_nearest (ArgSpec(args=['input', 'out_shape', 'scale', 'name', 'actual_shape', 'align_corners'], varargs=None, keywords=None, defaults=(None, None, None, None, True)), ('document', '735fa9758a6d7ff3b47d7b827f961c1d')) diff --git a/python/paddle/fluid/tests/unittests/test_npair_loss_op.py b/python/paddle/fluid/tests/unittests/test_npair_loss_op.py index 9868a69e4..ab69d3ad7 100644 --- a/python/paddle/fluid/tests/unittests/test_npair_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_npair_loss_op.py @@ -71,10 +71,13 @@ class TestNpairLossOp(unittest.TestCase): feat_dim).astype(np.float32) embeddings_positive = np.random.rand(num_data, feat_dim).astype(np.float32) - labels = np.random.randint( + row_labels = np.random.randint( 0, num_classes, size=(num_data)).astype(np.float32) out_loss = npairloss( - embeddings_anchor, embeddings_positive, labels, l2_reg=reg_lambda) + embeddings_anchor, + embeddings_positive, + row_labels, + l2_reg=reg_lambda) anchor_tensor = fluid.layers.data( name='anchor', @@ -86,9 +89,8 @@ class TestNpairLossOp(unittest.TestCase): shape=[num_data, feat_dim], dtype=self.dtype, append_batch_size=False) - rname = 'labels' + str(np.random.rand()).split('.')[1] labels_tensor = fluid.layers.data( - name=rname, + name='labels', shape=[num_data], dtype=self.dtype, append_batch_size=False) @@ -101,7 +103,7 @@ class TestNpairLossOp(unittest.TestCase): out_tensor = exe.run(feed={ 'anchor': embeddings_anchor, 'positive': embeddings_positive, - rname: labels + 'labels': row_labels }, fetch_list=[npair_loss_op.name]) -- GitLab