提交 7613918e 编写于 作者: C ceci3

test=develop, change labels name

上级 6fe7478b
...@@ -144,7 +144,7 @@ paddle.fluid.layers.label_smooth (ArgSpec(args=['label', 'prior_dist', 'epsilon' ...@@ -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_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.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.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.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_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')) 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'))
......
...@@ -71,10 +71,13 @@ class TestNpairLossOp(unittest.TestCase): ...@@ -71,10 +71,13 @@ class TestNpairLossOp(unittest.TestCase):
feat_dim).astype(np.float32) feat_dim).astype(np.float32)
embeddings_positive = np.random.rand(num_data, embeddings_positive = np.random.rand(num_data,
feat_dim).astype(np.float32) feat_dim).astype(np.float32)
labels = np.random.randint( row_labels = np.random.randint(
0, num_classes, size=(num_data)).astype(np.float32) 0, num_classes, size=(num_data)).astype(np.float32)
out_loss = npairloss( 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( anchor_tensor = fluid.layers.data(
name='anchor', name='anchor',
...@@ -86,9 +89,8 @@ class TestNpairLossOp(unittest.TestCase): ...@@ -86,9 +89,8 @@ class TestNpairLossOp(unittest.TestCase):
shape=[num_data, feat_dim], shape=[num_data, feat_dim],
dtype=self.dtype, dtype=self.dtype,
append_batch_size=False) append_batch_size=False)
rname = 'labels' + str(np.random.rand()).split('.')[1]
labels_tensor = fluid.layers.data( labels_tensor = fluid.layers.data(
name=rname, name='labels',
shape=[num_data], shape=[num_data],
dtype=self.dtype, dtype=self.dtype,
append_batch_size=False) append_batch_size=False)
...@@ -101,7 +103,7 @@ class TestNpairLossOp(unittest.TestCase): ...@@ -101,7 +103,7 @@ class TestNpairLossOp(unittest.TestCase):
out_tensor = exe.run(feed={ out_tensor = exe.run(feed={
'anchor': embeddings_anchor, 'anchor': embeddings_anchor,
'positive': embeddings_positive, 'positive': embeddings_positive,
rname: labels 'labels': row_labels
}, },
fetch_list=[npair_loss_op.name]) fetch_list=[npair_loss_op.name])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册