提交 c4f8f3bd 编写于 作者: Z zhupengyang 提交者: Tao Luo

use large input shape for accuracy test (#21758)

- ngarph: elementwise_sub, elementwise_mul
- mkldnn: transpose, sum
- others: scatter_nd

test=develop
上级 92f83e46
......@@ -25,9 +25,9 @@ class TestMKLDNN(TestSumOp):
self.op_type = "sum"
self.init_kernel_type()
self.use_mkldnn = True
x0 = np.random.random((3, 4)).astype(self.dtype)
x1 = np.random.random((3, 4)).astype(self.dtype)
x2 = np.random.random((3, 4)).astype(self.dtype)
x0 = np.random.random((25, 4)).astype(self.dtype)
x1 = np.random.random((25, 4)).astype(self.dtype)
x2 = np.random.random((25, 4)).astype(self.dtype)
self.inputs = {"X": [("x0", x0), ("x1", x1), ("x2", x2)]}
y = x0 + x1 + x2
self.outputs = {'Out': y}
......
......@@ -48,13 +48,13 @@ class TestTransposeMKLDNN(TestTransposeOp):
self.check_grad(['X'], 'Out', check_dygraph=False)
def initTestCase(self):
self.shape = (3, 4)
self.shape = (30, 4)
self.axis = (1, 0)
class TestCase0MKLDNN(TestTransposeMKLDNN):
def initTestCase(self):
self.shape = (3, )
self.shape = (100, )
self.axis = (0, )
......
......@@ -83,7 +83,7 @@ class TestElementwiseMulOp_scalar(ElementwiseMulOp):
def setUp(self):
self.op_type = "elementwise_mul"
self.inputs = {
'X': np.random.rand(2, 3, 4).astype(np.float32),
'X': np.random.rand(10, 3, 4).astype(np.float32),
'Y': np.random.rand(1).astype(np.float32)
}
self.outputs = {'Out': self.inputs['X'] * self.inputs['Y']}
......@@ -94,8 +94,8 @@ class TestElementwiseMulOp_Vector(ElementwiseMulOp):
def setUp(self):
self.op_type = "elementwise_mul"
self.inputs = {
'X': np.random.random((32, )).astype("float64"),
'Y': np.random.random((32, )).astype("float64")
'X': np.random.random((100, )).astype("float64"),
'Y': np.random.random((100, )).astype("float64")
}
self.outputs = {'Out': np.multiply(self.inputs['X'], self.inputs['Y'])}
self.init_kernel_type()
......@@ -103,7 +103,7 @@ class TestElementwiseMulOp_Vector(ElementwiseMulOp):
class TestElementwiseMulOp_broadcast_0(ElementwiseMulOp):
def init_input_output(self):
self.x = np.random.rand(2, 3, 4).astype(self.dtype)
self.x = np.random.rand(2, 13, 4).astype(self.dtype)
self.y = np.random.rand(2).astype(self.dtype)
self.out = self.x * self.y.reshape(2, 1, 1)
......@@ -115,7 +115,7 @@ class TestElementwiseMulOp_broadcast_1(ElementwiseMulOp):
def setUp(self):
self.op_type = "elementwise_mul"
self.inputs = {
'X': np.random.rand(2, 3, 4).astype(np.float64),
'X': np.random.rand(10, 3, 4).astype(np.float64),
'Y': np.random.rand(3).astype(np.float64)
}
......@@ -130,7 +130,7 @@ class TestElementwiseMulOp_broadcast_2(ElementwiseMulOp):
def setUp(self):
self.op_type = "elementwise_mul"
self.inputs = {
'X': np.random.rand(2, 3, 4).astype(np.float64),
'X': np.random.rand(10, 3, 4).astype(np.float64),
'Y': np.random.rand(4).astype(np.float64)
}
......
......@@ -46,7 +46,7 @@ class TestElementwiseSubOp_scalar(TestElementwiseOp):
def setUp(self):
self.op_type = "elementwise_sub"
self.inputs = {
'X': np.random.rand(2, 3, 4).astype(np.float32),
'X': np.random.rand(10, 3, 4).astype(np.float32),
'Y': np.random.rand(1).astype(np.float32)
}
self.outputs = {'Out': self.inputs['X'] - self.inputs['Y']}
......@@ -56,8 +56,8 @@ class TestElementwiseSubOp_Vector(TestElementwiseOp):
def setUp(self):
self.op_type = "elementwise_sub"
self.inputs = {
'X': np.random.random((32, )).astype("float32"),
'Y': np.random.random((32, )).astype("float32")
'X': np.random.random((100, )).astype("float32"),
'Y': np.random.random((100, )).astype("float32")
}
self.outputs = {'Out': self.inputs['X'] - self.inputs['Y']}
......@@ -66,7 +66,7 @@ class TestElementwiseSubOp_broadcast_0(TestElementwiseOp):
def setUp(self):
self.op_type = "elementwise_sub"
self.inputs = {
'X': np.random.rand(2, 3, 4).astype(np.float32),
'X': np.random.rand(2, 13, 4).astype(np.float32),
'Y': np.random.rand(2).astype(np.float32)
}
......
......@@ -65,9 +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")
index_np = np.array([[1], [2], [3], [5], [1]]).astype("int32")
updates_np = np.array([9, 10, 11, 12, 13]).astype("float32")
#ref_np = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8]).astype("float32")
ref_np = np.random.random([100]).astype("float32")
index_np = np.random.randint(0, 100, [100, 1]).astype("int32")
updates_np = np.random.random([100]).astype("float32")
expect_np = numpy_scatter_nd_add(ref_np.copy(), index_np, updates_np)
#expect_np = [ 0. 23. 12. 14. 4. 17. 6. 7. 8.]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册