Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PIR]Open uts for sequence_mask #60704

Merged
merged 3 commits into from
Jan 11, 2024
Merged
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
12 changes: 6 additions & 6 deletions test/sequence/test_sequence_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

import paddle
from paddle.base.framework import (
Program,
convert_np_dtype_to_dtype_,
program_guard,
)
from paddle.pir_utils import test_with_pir_api


def sequence_mask_wraper(x, maxlen_tensor=None, maxlen=-1, mask_dtype='int64'):
Expand Down Expand Up @@ -168,15 +167,16 @@ def initParameters(self):


class TestSequenceMaskOpError(unittest.TestCase):
@test_with_pir_api
def test_errors(self):
with program_guard(Program(), Program()):
with paddle.static.program_guard(
paddle.static.Program(), paddle.static.Program()
):
input_data = np.random.uniform(1, 5, [4]).astype("float32")

def test_Variable():
# the input must be Variable
paddle.static.nn.sequence_lod.sequence_mask(
input_data, maxlen=4
)
paddle.nn.functional.sequence_mask(input_data, maxlen=4)

self.assertRaises(TypeError, test_Variable)

Expand Down