Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/legacy_test/test_batch_norm_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ def init_test_case(self):


class TestBatchNormOpError(unittest.TestCase):
@test_with_pir_api
def test_errors(self):
with program_guard(Program(), Program()):
# the input of batch_norm must be Variable.
Expand All @@ -942,6 +943,7 @@ def test_errors(self):


class TestDygraphBatchNormAPIError(unittest.TestCase):
@test_with_pir_api
def test_errors(self):
with program_guard(Program(), Program()):
batch_norm = paddle.nn.BatchNorm(10)
Expand Down
2 changes: 2 additions & 0 deletions test/legacy_test/test_bicubic_interp_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from paddle import base
from paddle.base import Program, program_guard
from paddle.nn.functional import interpolate
from paddle.pir_utils import test_with_pir_api


def cubic_1(x, a):
Expand Down Expand Up @@ -363,6 +364,7 @@ def test_case(self):


class TestBicubicOpError(unittest.TestCase):
@test_with_pir_api
def test_errors(self):
with program_guard(Program(), Program()):
# the input of interpoalte must be Variable.
Expand Down
2 changes: 2 additions & 0 deletions test/legacy_test/test_clip_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def initTestCase(self):


class TestClipOpError(unittest.TestCase):
@test_with_pir_api
def test_errors(self):
paddle.enable_static()
with program_guard(Program(), Program()):
Expand Down Expand Up @@ -424,6 +425,7 @@ def test_clip_dygraph_default_max(self):
np.testing.assert_allclose(out2.numpy(), egr_out2.numpy(), rtol=1e-05)
np.testing.assert_allclose(out3.numpy(), egr_out3.numpy(), rtol=1e-05)

@test_with_pir_api
def test_errors(self):
paddle.enable_static()
x1 = paddle.static.data(name='x1', shape=[1], dtype="int16")
Expand Down
2 changes: 2 additions & 0 deletions test/legacy_test/test_conv2d_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import paddle
from paddle import base
from paddle.base import Program, core, program_guard
from paddle.pir_utils import test_with_pir_api


def conv2d_forward_naive(
Expand Down Expand Up @@ -726,6 +727,7 @@ def init_kernel_type(self):


class TestConv2DOpError(unittest.TestCase):
@test_with_pir_api
def test_errors(self):
with program_guard(Program(), Program()):

Expand Down
2 changes: 2 additions & 0 deletions test/legacy_test/test_dot_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import paddle
from paddle import base
from paddle.base import Program, core, program_guard
from paddle.pir_utils import test_with_pir_api


class DotOp(OpTest):
Expand Down Expand Up @@ -131,6 +132,7 @@ def test_check_grad_ingore_y(self):


class TestDotOpError(unittest.TestCase):
@test_with_pir_api
def test_errors(self):
with program_guard(Program(), Program()):
# the input dtype of elementwise_mul must be float16 or float32 or float64 or int32 or int64
Expand Down
4 changes: 4 additions & 0 deletions test/legacy_test/test_eig_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import paddle
from paddle import base
from paddle.base import core
from paddle.pir_utils import test_with_pir_api


# cast output to complex for numpy.linalg.eig
Expand Down Expand Up @@ -348,6 +349,7 @@ def test_check_grad(self):


class TestEigWrongDimsError(unittest.TestCase):
@test_with_pir_api
def test_error(self):
paddle.device.set_device("cpu")
paddle.disable_static()
Expand All @@ -357,6 +359,7 @@ def test_error(self):


class TestEigNotSquareError(unittest.TestCase):
@test_with_pir_api
def test_error(self):
paddle.device.set_device("cpu")
paddle.disable_static()
Expand All @@ -366,6 +369,7 @@ def test_error(self):


class TestEigUnsupportedDtypeError(unittest.TestCase):
@test_with_pir_api
def test_error(self):
paddle.device.set_device("cpu")
paddle.disable_static()
Expand Down
2 changes: 2 additions & 0 deletions test/legacy_test/test_eigvals_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import paddle
from paddle.base import core
from paddle.pir_utils import test_with_pir_api

np.set_printoptions(threshold=np.inf)

Expand Down Expand Up @@ -324,6 +325,7 @@ def test_cases(self):
self.run_dygraph(place)
self.run_static(place)

@test_with_pir_api
def test_error(self):
paddle.disable_static()
x = paddle.to_tensor([1])
Expand Down
3 changes: 3 additions & 0 deletions test/legacy_test/test_gather_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ def test_static_graph():


class TestGathertError(unittest.TestCase):
@test_with_pir_api
def test_error1(self):
with paddle.static.program_guard(
paddle.static.Program(), paddle.static.Program()
Expand Down Expand Up @@ -567,6 +568,7 @@ def test_axis_dtype1():

self.assertRaises(TypeError, test_axis_dtype1)

@test_with_pir_api
def test_error2(self):
with base.program_guard(base.Program(), base.Program()):
shape = [8, 9, 6]
Expand All @@ -586,6 +588,7 @@ def test_index_type():

self.assertRaises(TypeError, test_index_type)

@test_with_pir_api
def test_error3(self):
with paddle.static.program_guard(
paddle.static.Program(), paddle.static.Program()
Expand Down
1 change: 1 addition & 0 deletions test/legacy_test/test_min_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_api(self):
(res,) = exe.run(feed={"data": input_data}, fetch_list=[result_min])
self.assertEqual((res == np.min(input_data, axis=(0, 1))).all(), True)

@test_with_pir_api
def test_errors(self):
paddle.enable_static()

Expand Down
1 change: 1 addition & 0 deletions test/legacy_test/test_prod_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def test_gpu(self):


class TestProdOpError(unittest.TestCase):
@test_with_pir_api
def test_error(self):
with paddle.static.program_guard(
paddle.static.Program(), paddle.static.Program()
Expand Down
2 changes: 2 additions & 0 deletions test/legacy_test/test_solve_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from paddle import base
from paddle.base import Program, program_guard
from paddle.pir_utils import test_with_pir_api


# 2D normal case
Expand Down Expand Up @@ -258,6 +259,7 @@ def test_check_grad_normal(self):


class TestSolveOpError(unittest.TestCase):
@test_with_pir_api
def test_errors(self):
with program_guard(Program(), Program()):
# The input type of solve_op must be Variable.
Expand Down