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

【Fix PIR Unittest No.27】Fix test_slice_var PIR mode #66183

Closed
wants to merge 1 commit into from
Closed
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
19 changes: 10 additions & 9 deletions test/deprecated/legacy_test/test_slice_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@

import random
import unittest

import paddle
from paddle import base
from paddle.distributed.transpiler.distribute_transpiler import slice_variable


class TestSliceVar(unittest.TestCase):
def check_slice_output(self, shapes, expected_sizes, min_size):
var_list = []
program = base.Program()
for shape in shapes:
var = program.global_block().create_var(
name=str(random.randint(10000, 99999)),
persistable=True,
shape=shape,
)
var_list.append(var)
with paddle.pir_utils.OldIrGuard():
program = base.Program()
for shape in shapes:
var = program.global_block().create_var(
name=str(random.randint(10000, 99999)),
persistable=True,
shape=shape,
)
var_list.append(var)
blocks = slice_variable(var_list, 10, min_size)
all_sizes = []
for s in expected_sizes:
Expand Down