未验证 提交 65bce2b3 编写于 作者: 姜永久 提交者: GitHub

Yj/eager op test part 1 (#49877)

* update tril unbind ops for eager tests

* add eager op test

* reset unbind

* lint

* lint

* rm eager checker

* copyright 2018->2023
上级 b2706b0c
此差异已折叠。
......@@ -17,7 +17,7 @@ import unittest
import gradient_checker
import numpy as np
from decorator_helper import prog_scope
from op_test import OpTest
from eager_op_test import OpTest
import paddle
import paddle.fluid as fluid
......@@ -28,6 +28,7 @@ from paddle.fluid import Program, core, program_guard
class TestTileOpRank1(OpTest):
def setUp(self):
self.op_type = "tile"
self.python_api = paddle.tile
self.init_data()
self.inputs = {'X': np.random.random(self.ori_shape).astype("float64")}
......@@ -105,6 +106,7 @@ class TestTileOpRank4(TestTileOpRank1):
class TestTileOpRank1_tensor_attr(OpTest):
def setUp(self):
self.op_type = "tile"
self.python_api = paddle.tile
self.init_data()
repeat_times_tensor = []
for index, ele in enumerate(self.repeat_times):
......@@ -150,6 +152,7 @@ class TestTileOpRank2_attr_tensor(TestTileOpRank1_tensor_attr):
class TestTileOpRank1_tensor(OpTest):
def setUp(self):
self.op_type = "tile"
self.python_api = paddle.tile
self.init_data()
self.inputs = {
......@@ -181,6 +184,7 @@ class TestTileOpRank2_tensor(TestTileOpRank1_tensor):
class TestTileOpInteger(OpTest):
def setUp(self):
self.op_type = "tile"
self.python_api = paddle.tile
self.inputs = {
'X': np.random.randint(10, size=(4, 4, 5)).astype("int32")
}
......@@ -196,6 +200,7 @@ class TestTileOpInteger(OpTest):
class TestTileOpBoolean(OpTest):
def setUp(self):
self.op_type = "tile"
self.python_api = paddle.tile
self.inputs = {'X': np.random.randint(2, size=(2, 4, 5)).astype("bool")}
self.attrs = {'repeat_times': [2, 1, 4]}
output = np.tile(self.inputs['X'], (2, 1, 4))
......@@ -209,6 +214,7 @@ class TestTileOpBoolean(OpTest):
class TestTileOpInt64_t(OpTest):
def setUp(self):
self.op_type = "tile"
self.python_api = paddle.tile
self.inputs = {
'X': np.random.randint(10, size=(2, 4, 5)).astype("int64")
}
......
......@@ -15,7 +15,7 @@
import unittest
import numpy as np
from op_test import OpTest
from eager_op_test import OpTest
import paddle
import paddle.fluid as fluid
......@@ -24,6 +24,7 @@ import paddle.fluid as fluid
class TestTrilIndicesOp(OpTest):
def setUp(self):
self.op_type = "tril_indices"
self.python_api = paddle.tril_indices
self.inputs = {}
self.init_config()
self.outputs = {'out': self.target}
......
......@@ -15,7 +15,7 @@
import unittest
import numpy as np
from op_test import OpTest
from eager_op_test import OpTest
import paddle
import paddle.fluid as fluid
......@@ -24,6 +24,7 @@ import paddle.fluid as fluid
class TestTriuIndicesOp(OpTest):
def setUp(self):
self.op_type = "triu_indices"
self.python_api = paddle.triu_indices
self.inputs = {}
self.init_config()
self.outputs = {'out': self.target}
......
......@@ -15,7 +15,7 @@
import unittest
import numpy as np
from op_test import OpTest
from eager_op_test import OpTest
import paddle
import paddle.fluid as fluid
......@@ -123,6 +123,7 @@ class TestUnfoldOp(OpTest):
def setUp(self):
self.op_type = 'unfold'
self.python_api = paddle.nn.functional.unfold
self.set_data()
def test_check_output(self):
......@@ -139,6 +140,7 @@ class TestUnfoldAPI(TestUnfoldOp):
def setUp(self):
self.op_type = 'unfold'
self.python_api = paddle.nn.functional.unfold
self.set_data()
self.places = [fluid.CPUPlace()]
if core.is_compiled_with_cuda():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册