From bf978fffe5ee8b68882336aaf8f6c4be9951de06 Mon Sep 17 00:00:00 2001 From: zhupengyang <1165938320@qq.com> Date: Sat, 4 Jan 2020 23:10:01 +0800 Subject: [PATCH] all cases use large shape (#22084) flatten, flatten2, gather, gather_nd, group_norm, gru, gru_unit, reduce_max, reduce_min, reduce_mean, reduce_sum, reshape, scatter_nd_add, sequence_expand, sequence_expand_as, sequence_pad --- .../sequence/test_sequence_expand.py | 14 ++--- .../sequence/test_sequence_expand_as.py | 6 +- .../sequence/test_sequence_pad_op.py | 20 +++---- .../fluid/tests/unittests/test_flatten2_op.py | 4 +- .../fluid/tests/unittests/test_flatten_op.py | 4 +- .../tests/unittests/test_gather_nd_op.py | 6 +- .../fluid/tests/unittests/test_gather_op.py | 2 +- .../tests/unittests/test_group_norm_op.py | 2 +- .../fluid/tests/unittests/test_gru_op.py | 7 +-- .../fluid/tests/unittests/test_gru_unit_op.py | 2 +- .../fluid/tests/unittests/test_reduce_op.py | 12 ++-- .../fluid/tests/unittests/test_reshape_op.py | 58 +++++++++---------- .../tests/unittests/test_scatter_nd_op.py | 8 +-- 13 files changed, 67 insertions(+), 78 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand.py b/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand.py index 51e6f31d9cb..b3d877a0cd6 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand.py +++ b/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand.py @@ -82,7 +82,7 @@ class TestSequenceExpand(OpTest): class TestSequenceExpandCase1(TestSequenceExpand): def set_data(self): - x_data = np.random.uniform(0.1, 1, [5, 1]).astype('float64') + x_data = np.random.uniform(0.1, 1, [5, 20]).astype('float64') y_data = np.random.uniform(0.1, 1, [13, 1]).astype('float64') y_lod = [[2, 3], [2, 2, 3, 3, 3]] self.inputs = {'X': x_data, 'Y': (y_data, y_lod)} @@ -91,7 +91,7 @@ class TestSequenceExpandCase1(TestSequenceExpand): class TestSequenceExpandCase2(TestSequenceExpand): def set_data(self): - x_data = np.random.uniform(0.1, 1, [1, 2, 2]).astype('float64') + x_data = np.random.uniform(0.1, 1, [1, 2, 50]).astype('float64') x_lod = [[1]] y_data = np.random.uniform(0.1, 1, [2, 2, 2]).astype('float64') y_lod = [[2], [1, 1]] @@ -101,7 +101,7 @@ class TestSequenceExpandCase2(TestSequenceExpand): class TestSequenceExpandCase3(TestSequenceExpand): def set_data(self): - x_data = np.random.uniform(0.1, 1, [4, 1]).astype('float64') + x_data = np.random.uniform(0.1, 1, [4, 25]).astype('float64') x_lod = [[1, 1, 1, 1]] y_data = np.random.uniform(0.1, 1, [8, 1]).astype('float64') y_lod = [[2, 2, 2, 2]] @@ -110,8 +110,8 @@ class TestSequenceExpandCase3(TestSequenceExpand): class TestSequenceExpandCase4(TestSequenceExpand): def set_data(self): - data = np.random.uniform(0.1, 1, [5 * 2, 1]) - x_data = np.array(data).reshape([5, 2]).astype('float64') + data = np.random.uniform(0.1, 1, [5 * 20, 1]) + x_data = np.array(data).reshape([5, 20]).astype('float64') x_lod = [[2, 3]] y_data = np.random.uniform(0.1, 1, [5, 1]).astype('float64') y_lod = [[2], [2, 3]] @@ -120,7 +120,7 @@ class TestSequenceExpandCase4(TestSequenceExpand): class TestSequenceExpandCase5(TestSequenceExpand): def set_data(self): - x_data = np.random.uniform(0.1, 1, [6, 1]).astype('float64') + x_data = np.random.uniform(0.1, 1, [6, 20]).astype('float64') y_data = np.random.uniform(0.1, 1, [13, 1]).astype('float64') y_lod = [[2, 4], [2, 2, 3, 0, 3, 3]] self.inputs = {'X': x_data, 'Y': (y_data, y_lod)} @@ -129,7 +129,7 @@ class TestSequenceExpandCase5(TestSequenceExpand): class TestSequenceExpandCase6(TestSequenceExpand): def set_data(self): - x_data = np.random.uniform(0.1, 1, [4, 1]).astype('float64') + x_data = np.random.uniform(0.1, 1, [4, 25]).astype('float64') x_lod = [[1, 1, 0, 1, 1]] y_data = np.random.uniform(0.1, 1, [8, 1]).astype('float64') y_lod = [[0, 2, 4, 2, 0]] diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand_as.py b/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand_as.py index f038b00a3bd..3b3a1e9d5cd 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand_as.py +++ b/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand_as.py @@ -59,7 +59,7 @@ class TestSequenceExpandAs(OpTest): class TestSequenceExpandAsCase1(TestSequenceExpandAs): def set_data(self): - x_data = np.random.uniform(0.1, 1, [5, 1]).astype('float64') + x_data = np.random.uniform(0.1, 1, [5, 20]).astype('float64') x_lod = [[2, 3]] y_data = np.random.uniform(0.1, 1, [10, 1]).astype('float64') y_lod = [[2, 2, 0, 3, 3]] @@ -68,7 +68,7 @@ class TestSequenceExpandAsCase1(TestSequenceExpandAs): class TestSequenceExpandAsCase2(TestSequenceExpandAs): def set_data(self): - x_data = np.random.uniform(0.1, 1, [5, 1]).astype('float64') + x_data = np.random.uniform(0.1, 1, [5, 20]).astype('float64') x_lod = [[2, 3]] y_data = np.random.uniform(0.1, 1, [10, 1]).astype('float64') y_lod = [[0, 4, 0, 6, 0]] @@ -77,7 +77,7 @@ class TestSequenceExpandAsCase2(TestSequenceExpandAs): class TestSequenceExpandAsCase3(TestSequenceExpandAs): def set_data(self): - x_data = np.random.uniform(0.1, 1, [1, 2, 2]).astype('float64') + x_data = np.random.uniform(0.1, 1, [1, 2, 50]).astype('float64') x_lod = [[1]] y_data = np.random.uniform(0.1, 1, [2, 2, 2]).astype('float64') y_lod = [[2]] diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py b/python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py index 83c28edd235..d04f10139b4 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py +++ b/python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py @@ -82,16 +82,16 @@ class TestSequencePadOp(OpTest): class TestSequencePadOp2(TestSequencePadOp): def set_attr(self): - self.x_shape = [12, 4] + self.x_shape = [12, 10] self.x_len_lod = [[2, 3, 4, 3]] - self.pad_value = [1.0, 2.0, 3.0, 4.0] + self.pad_value = np.random.random((10)) self.padded_length = -1 self.dtype = 'float64' class TestSequencePadOp3(TestSequencePadOp): def set_attr(self): - self.x_shape = [12, 4] + self.x_shape = [12, 10] self.x_len_lod = [[2, 3, 4, 3]] self.pad_value = [1.0] self.padded_length = 7 @@ -100,16 +100,16 @@ class TestSequencePadOp3(TestSequencePadOp): class TestSequencePadOp4(TestSequencePadOp): def set_attr(self): - self.x_shape = [12, 4] + self.x_shape = [12, 10] self.x_len_lod = [[2, 3, 4, 3]] - self.pad_value = [1.0, 2.0, 3.0, 4.0] + self.pad_value = np.random.random((10)) self.padded_length = 7 self.dtype = 'float64' class TestSequencePadOp5(TestSequencePadOp): def set_attr(self): - self.x_shape = [12, 2, 2] + self.x_shape = [12, 2, 5] self.x_len_lod = [[2, 3, 4, 3]] self.pad_value = [1.0] self.padded_length = -1 @@ -118,16 +118,16 @@ class TestSequencePadOp5(TestSequencePadOp): class TestSequencePadOp6(TestSequencePadOp): def set_attr(self): - self.x_shape = [12, 2, 2] + self.x_shape = [12, 2, 5] self.x_len_lod = [[2, 3, 4, 3]] - self.pad_value = [[1.0, 2.0], [3.0, 4.0]] + self.pad_value = np.random.random((2, 5)) self.padded_length = -1 self.dtype = 'float64' class TestSequencePadOp7(TestSequencePadOp): def set_attr(self): - self.x_shape = [12, 2, 2] + self.x_shape = [12, 2, 5] self.x_len_lod = [[2, 3, 4, 3]] self.pad_value = [1.0] self.padded_length = 7 @@ -136,7 +136,7 @@ class TestSequencePadOp7(TestSequencePadOp): class TestSequencePadOp8(TestSequencePadOp): def set_attr(self): - self.x_shape = [12, 2, 2] + self.x_shape = [12, 2, 5] self.x_len_lod = [[0, 8, 0, 4, 0]] self.pad_value = [1.0] self.padded_length = 10 diff --git a/python/paddle/fluid/tests/unittests/test_flatten2_op.py b/python/paddle/fluid/tests/unittests/test_flatten2_op.py index 9fe2d7b20c9..c37e115fdc6 100644 --- a/python/paddle/fluid/tests/unittests/test_flatten2_op.py +++ b/python/paddle/fluid/tests/unittests/test_flatten2_op.py @@ -55,8 +55,8 @@ class TestFlattenOp(TestFlattenOp): class TestFlattenOpWithDefaultAxis(TestFlattenOp): def init_test_case(self): - self.in_shape = (3, 2, 2, 3) - self.new_shape = (3, 12) + self.in_shape = (10, 2, 2, 3) + self.new_shape = (10, 12) def init_attrs(self): self.attrs = {} diff --git a/python/paddle/fluid/tests/unittests/test_flatten_op.py b/python/paddle/fluid/tests/unittests/test_flatten_op.py index 902ce1613a1..cf568970b73 100644 --- a/python/paddle/fluid/tests/unittests/test_flatten_op.py +++ b/python/paddle/fluid/tests/unittests/test_flatten_op.py @@ -52,8 +52,8 @@ class TestFlattenOp(TestFlattenOp): class TestFlattenOpWithDefaultAxis(TestFlattenOp): def init_test_case(self): - self.in_shape = (3, 2, 2, 3) - self.new_shape = (3, 12) + self.in_shape = (10, 2, 2, 3) + self.new_shape = (10, 12) def init_attrs(self): self.attrs = {} diff --git a/python/paddle/fluid/tests/unittests/test_gather_nd_op.py b/python/paddle/fluid/tests/unittests/test_gather_nd_op.py index 95cfdaa5e84..892f63bf15b 100644 --- a/python/paddle/fluid/tests/unittests/test_gather_nd_op.py +++ b/python/paddle/fluid/tests/unittests/test_gather_nd_op.py @@ -47,8 +47,7 @@ class TestGatherNdOpWithLowIndex(OpTest): def setUp(self): self.op_type = "gather_nd" - xnp = np.array( - [[65, 17, 2], [14, 25, 1], [76, 22, 3]]).astype("float64") + xnp = np.random.uniform(0, 100, (10, 10)).astype("float64") index = np.array([[1], [2]]).astype("int64") self.inputs = {'X': xnp, 'Index': index} @@ -69,8 +68,7 @@ class TestGatherNdOpWithSameIndexAsX(OpTest): def setUp(self): self.op_type = "gather_nd" - xnp = np.array( - [[65, 17, 2], [14, 25, 1], [76, 22, 3]]).astype("float64") + xnp = np.random.uniform(0, 100, (10, 10)).astype("float64") index = np.array([[1, 1], [2, 1]]).astype("int64") self.inputs = {'X': xnp, 'Index': index} diff --git a/python/paddle/fluid/tests/unittests/test_gather_op.py b/python/paddle/fluid/tests/unittests/test_gather_op.py index 9f89bd5b5c9..340be3238d1 100644 --- a/python/paddle/fluid/tests/unittests/test_gather_op.py +++ b/python/paddle/fluid/tests/unittests/test_gather_op.py @@ -62,7 +62,7 @@ class TestCase2(TestGatherOp): """ For int64_t index type """ - self.x_shape = (10) + self.x_shape = (100) self.x_type = "float64" self.index = [1, 3, 5] self.index_type = "int64" diff --git a/python/paddle/fluid/tests/unittests/test_group_norm_op.py b/python/paddle/fluid/tests/unittests/test_group_norm_op.py index eb69e283a35..716019f3d16 100644 --- a/python/paddle/fluid/tests/unittests/test_group_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_group_norm_op.py @@ -45,7 +45,7 @@ class TestGroupNormOp(OpTest): self.op_type = "group_norm" self.data_format = "NCHW" self.dtype = np.float64 - self.shape = (2, 4, 3, 5) + self.shape = (2, 100, 3, 5) self.attrs = {'epsilon': 1e-5, 'groups': 2, 'data_layout': "NCHW"} self.compare_between_place = False self.init_test_case() diff --git a/python/paddle/fluid/tests/unittests/test_gru_op.py b/python/paddle/fluid/tests/unittests/test_gru_op.py index cc041991e78..b3a6d5cc7ce 100644 --- a/python/paddle/fluid/tests/unittests/test_gru_op.py +++ b/python/paddle/fluid/tests/unittests/test_gru_op.py @@ -107,7 +107,7 @@ class TestGRUOp(OpTest): def setUp(self): self.op_type = "gru" self.lod = [[2, 4, 3]] - self.D = 5 + self.D = 40 self.is_reverse = False self.with_h0 = True self.with_bias = True @@ -169,27 +169,23 @@ class TestGRUOriginMode(TestGRUOp): class TestGRUOp2(TestGRUOp): def set_confs(self): - self.D = 19 self.dtype = 'float64' class TestGRUOp2Len0(TestGRUOp): def set_confs(self): - self.D = 19 self.lod = [[2, 0, 4]] self.dtype = 'float64' class TestGRUOp2OriginMode(TestGRUOp): def set_confs(self): - self.D = 19 self.dtype = 'float64' self.origin_mode = True class TestGRUOp2OriginModeLen0(TestGRUOp): def set_confs(self): - self.D = 19 self.lod = [[0, 3, 4]] self.dtype = 'float64' self.origin_mode = True @@ -197,7 +193,6 @@ class TestGRUOp2OriginModeLen0(TestGRUOp): class TestGRUOp2OriginModeLastLen0(TestGRUOp): def set_confs(self): - self.D = 19 self.lod = [[0, 3, 0]] self.dtype = 'float64' self.origin_mode = True diff --git a/python/paddle/fluid/tests/unittests/test_gru_unit_op.py b/python/paddle/fluid/tests/unittests/test_gru_unit_op.py index 78f2f030f5b..6164591992b 100644 --- a/python/paddle/fluid/tests/unittests/test_gru_unit_op.py +++ b/python/paddle/fluid/tests/unittests/test_gru_unit_op.py @@ -45,7 +45,7 @@ def relu(x): class TestGRUUnitOp(OpTest): batch_size = 5 - frame_size = 10 + frame_size = 40 activate = { GRUActivationType.identity: identity, GRUActivationType.sigmoid: sigmoid, diff --git a/python/paddle/fluid/tests/unittests/test_reduce_op.py b/python/paddle/fluid/tests/unittests/test_reduce_op.py index 2a1f8d3d551..efd1b15e920 100644 --- a/python/paddle/fluid/tests/unittests/test_reduce_op.py +++ b/python/paddle/fluid/tests/unittests/test_reduce_op.py @@ -333,7 +333,7 @@ class TestKeepDimReduceSumMultiAxises(OpTest): class TestReduceSumWithDimOne(OpTest): def setUp(self): self.op_type = "reduce_sum" - self.inputs = {'X': np.random.random((10, 1, 1)).astype("float64")} + self.inputs = {'X': np.random.random((100, 1, 1)).astype("float64")} self.attrs = {'dim': [1, 2], 'keep_dim': True} self.outputs = { 'Out': self.inputs['X'].sum(axis=tuple(self.attrs['dim']), @@ -350,7 +350,7 @@ class TestReduceSumWithDimOne(OpTest): class TestReduceSumWithNumelOne(OpTest): def setUp(self): self.op_type = "reduce_sum" - self.inputs = {'X': np.random.random((1, 1)).astype("float64")} + self.inputs = {'X': np.random.random((100, 1)).astype("float64")} self.attrs = {'dim': [1], 'keep_dim': False} self.outputs = { 'Out': self.inputs['X'].sum(axis=tuple(self.attrs['dim']), @@ -367,7 +367,7 @@ class TestReduceSumWithNumelOne(OpTest): class TestReduceMeanWithDimOne(OpTest): def setUp(self): self.op_type = "reduce_mean" - self.inputs = {'X': np.random.random((10, 1, 1)).astype("float64")} + self.inputs = {'X': np.random.random((100, 1, 1)).astype("float64")} self.attrs = {'dim': [1], 'keep_dim': False} self.outputs = { 'Out': self.inputs['X'].mean( @@ -384,7 +384,7 @@ class TestReduceMeanWithDimOne(OpTest): class TestReduceMeanWithNumelOne(OpTest): def setUp(self): self.op_type = "reduce_mean" - self.inputs = {'X': np.random.random((1, 1)).astype("float64")} + self.inputs = {'X': np.random.random((100, 1)).astype("float64")} self.attrs = {'dim': [1], 'keep_dim': True} self.outputs = { 'Out': self.inputs['X'].mean( @@ -401,7 +401,7 @@ class TestReduceMeanWithNumelOne(OpTest): class TestReduceAll(OpTest): def setUp(self): self.op_type = "reduce_sum" - self.inputs = {'X': np.random.random((1, 1, 1)).astype("float64")} + self.inputs = {'X': np.random.random((100, 1, 1)).astype("float64")} self.attrs = {'reduce_all': True, 'keep_dim': False} self.outputs = {'Out': self.inputs['X'].sum()} @@ -415,7 +415,7 @@ class TestReduceAll(OpTest): class Test1DReduceWithAxes1(OpTest): def setUp(self): self.op_type = "reduce_sum" - self.inputs = {'X': np.random.random(1).astype("float64")} + self.inputs = {'X': np.random.random(100).astype("float64")} self.attrs = {'dim': [0], 'keep_dim': False} self.outputs = {'Out': self.inputs['X'].sum(axis=0)} diff --git a/python/paddle/fluid/tests/unittests/test_reshape_op.py b/python/paddle/fluid/tests/unittests/test_reshape_op.py index b7c3b52c0e3..826737aeefa 100644 --- a/python/paddle/fluid/tests/unittests/test_reshape_op.py +++ b/python/paddle/fluid/tests/unittests/test_reshape_op.py @@ -55,9 +55,9 @@ class TestReshapeOpDimInfer1(TestReshapeOp): class TestReshapeOpDimInfer2(TestReshapeOp): def init_data(self): - self.ori_shape = (2, 2, 6) - self.new_shape = (2, 0, 3, -1) - self.infered_shape = (2, 2, 3, -1) + self.ori_shape = (10, 2, 6) + self.new_shape = (10, 0, 3, -1) + self.infered_shape = (10, 2, 3, -1) # situation 2: have shape(list, no tensor), have actual shape(Tensor) @@ -78,9 +78,9 @@ class TestReshapeOpWithInputShape(OpTest): } def init_data(self): - self.ori_shape = (6, 5) - self.new_shape = (0, -1, 5) - self.actual_shape = (2, 3, 5) + self.ori_shape = (6, 20) + self.new_shape = (0, -1, 20) + self.actual_shape = (2, 3, 20) def test_check_output(self): self.check_output(no_check_set=['XShape']) @@ -111,9 +111,9 @@ class TestReshapeOp_attr_ShapeTensor(OpTest): } def init_data(self): - self.ori_shape = (2, 25) - self.new_shape = (5, 10) - self.infered_shape = (5, 10) + self.ori_shape = (4, 25) + self.new_shape = (10, 10) + self.infered_shape = (10, 10) self.shape = (-1, -1) def test_check_output(self): @@ -125,18 +125,18 @@ class TestReshapeOp_attr_ShapeTensor(OpTest): class TestReshapeOpDimInfer1_attr_ShapeTensor(TestReshapeOp_attr_ShapeTensor): def init_data(self): - self.ori_shape = (5, 10) - self.new_shape = (5, -1, 5) - self.infered_shape = (5, -1, 5) + self.ori_shape = (5, 20) + self.new_shape = (5, -1, 20) + self.infered_shape = (5, -1, 20) self.shape = (5, -1, -1) class TestReshapeOpDimInfer2_attr_ShapeTensor(TestReshapeOp_attr_ShapeTensor): def init_data(self): - self.ori_shape = (2, 2, 6) - self.new_shape = (2, 0, 3, -1) - self.infered_shape = (2, 2, 3, -1) - self.shape = (2, 0, 3, -1) + self.ori_shape = (10, 2, 6) + self.new_shape = (10, 0, 3, -1) + self.infered_shape = (10, 2, 3, -1) + self.shape = (10, 0, 3, -1) # Situation 4: have shape(Tensor), no actual shape(Tensor) @@ -157,9 +157,9 @@ class TestReshapeOp_attr_OnlyShape(OpTest): } def init_data(self): - self.ori_shape = (2, 25) - self.new_shape = (5, 10) - self.infered_shape = (5, 10) + self.ori_shape = (4, 25) + self.new_shape = (10, 10) + self.infered_shape = (10, 10) def test_check_output(self): self.check_output(no_check_set=['XShape']) @@ -170,18 +170,18 @@ class TestReshapeOp_attr_OnlyShape(OpTest): class TestReshapeOpDimInfer1_attr_OnlyShape(TestReshapeOp_attr_OnlyShape): def init_data(self): - self.ori_shape = (5, 10) - self.new_shape = (5, -1, 5) - self.infered_shape = (5, -1, 5) + self.ori_shape = (5, 20) + self.new_shape = (5, -1, 10) + self.infered_shape = (5, -1, 10) self.shape = (5, -1, -1) class TestReshapeOpDimInfer2_attr_OnlyShape(TestReshapeOp_attr_OnlyShape): def init_data(self): - self.ori_shape = (2, 2, 6) - self.new_shape = (2, 0, 3, -1) - self.infered_shape = (2, 2, 3, -1) - self.shape = (2, 0, 3, -1) + self.ori_shape = (10, 2, 6) + self.new_shape = (10, 0, 3, -1) + self.infered_shape = (10, 2, 3, -1) + self.shape = (10, 0, 3, -1) # test int8 data type on CPU @@ -207,9 +207,9 @@ class TestReshapeInt8Op(OpTest): self.dtype = np.int8 def init_data(self): - self.ori_shape = (2, 2, 6) - self.new_shape = (2, 0, 3, -1) - self.infered_shape = (2, 2, 3, -1) + self.ori_shape = (10, 2, 6) + self.new_shape = (10, 0, 3, -1) + self.infered_shape = (10, 2, 3, -1) def test_check_output(self): self.check_output_with_place( diff --git a/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py b/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py index c8f4ed24e5c..7efa3e980c8 100644 --- a/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py +++ b/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py @@ -65,12 +65,10 @@ class TestScatterNdAddSimpleOp(OpTest): def setUp(self): self.op_type = "scatter_nd_add" - #ref_np = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8]).astype("float32") ref_np = np.random.random([100]).astype("float64") index_np = np.random.randint(0, 100, [100, 1]).astype("int32") updates_np = np.random.random([100]).astype("float64") expect_np = numpy_scatter_nd_add(ref_np.copy(), index_np, updates_np) - #expect_np = [ 0. 23. 12. 14. 4. 17. 6. 7. 8.] self.inputs = {'X': ref_np, 'Index': index_np, 'Updates': updates_np} self.outputs = {'Out': expect_np} @@ -89,13 +87,11 @@ class TestScatterNdAddWithEmptyIndex(OpTest): def setUp(self): self.op_type = "scatter_nd_add" - ref_np = np.array([[65, 17], [-14, -25]]).astype("float64") + ref_np = np.random.random((10, 10)).astype("float64") index_np = np.array([[], []]).astype("int32") - updates_np = np.array([[[-1, -2], [1, 2]], - [[3, 4], [-3, -4]]]).astype("float64") + updates_np = np.random.random((2, 10, 10)).astype("float64") expect_np = numpy_scatter_nd_add(ref_np.copy(), index_np, updates_np) - #expect_np = [[67, 19], [-16, -27]] self.inputs = {'X': ref_np, 'Index': index_np, 'Updates': updates_np} self.outputs = {'Out': expect_np} -- GitLab