Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 8 additions & 2 deletions test/legacy_test/test_linear_interp_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

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


def linear_interp_np(
Expand Down Expand Up @@ -325,8 +326,12 @@ def init_test_case(self):


class TestLinearInterpOpError(unittest.TestCase):
@test_with_pir_api
def test_error(self):
with program_guard(Program(), Program()):
paddle.enable_static()
with paddle.static.program_guard(
paddle.static.Program(), paddle.static.Program()
):

def input_shape_error():
x1 = paddle.static.data(name="x1", shape=[1], dtype="float32")
Expand Down Expand Up @@ -369,6 +374,7 @@ def out_shape_error():
self.assertRaises(ValueError, input_shape_error)
self.assertRaises(ValueError, data_format_error)
self.assertRaises(ValueError, out_shape_error)
paddle.disable_static()


if __name__ == "__main__":
Expand Down
8 changes: 6 additions & 2 deletions test/legacy_test/test_linear_interp_v2_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

import paddle
from paddle import base
from paddle.base import Program, core, program_guard
from paddle.base import core
from paddle.nn.functional import interpolate
from paddle.pir_utils import test_with_pir_api


def create_test_case0(self):
Expand Down Expand Up @@ -528,9 +529,12 @@ def init_test_case(self):


class TestLinearInterpOpError(unittest.TestCase):
@test_with_pir_api
def test_error(self):
with paddle_static_guard():
with program_guard(Program(), Program()):
with paddle.static.program_guard(
paddle.static.Program(), paddle.static.Program()
):

def input_shape_error():
x1 = paddle.static.data(
Expand Down