Skip to content

Commit eacac49

Browse files
committed
1. update test_split_var: replace split with slice
1 parent b33ea7b commit eacac49

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

python/paddle/fluid/tests/unittests/test_split_var.py renamed to python/paddle/fluid/tests/unittests/test_slice_var.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
import math
1616
import unittest
17-
from paddle.fluid.transpiler.distribute_transpiler import split_variable
17+
from paddle.fluid.transpiler.distribute_transpiler import slice_variable
1818
import paddle.fluid as fluid
1919
import paddle.fluid.core as core
2020
import random
2121

2222

23-
class TestSplitVar(unittest.TestCase):
24-
def check_split_output(self, shapes, expected_sizes, min_size):
23+
class TestSliceVar(unittest.TestCase):
24+
def check_slice_output(self, shapes, expected_sizes, min_size):
2525
var_list = []
2626
program = fluid.Program()
2727
for shape in shapes:
@@ -31,7 +31,7 @@ def check_split_output(self, shapes, expected_sizes, min_size):
3131
# dtype=core.VarDesc.VarType.LOD_TENSOR,
3232
shape=shape)
3333
var_list.append(var)
34-
blocks = split_variable(var_list, 10, min_size)
34+
blocks = slice_variable(var_list, 10, min_size)
3535
all_sizes = []
3636
for s in expected_sizes:
3737
for s2 in s:
@@ -49,15 +49,15 @@ def test_1k(self):
4949
[1150, 1150, 1150, 1150, 1150, 1150, 1100]
5050
]
5151

52-
self.check_split_output(shapes, expected_sizes, 1024)
52+
self.check_slice_output(shapes, expected_sizes, 1024)
5353

5454
def test_check_output_8k(self):
5555
shapes = [[3, 5], [1024], [28, 784], [8, 1020], [800, 10],
5656
[6, 33, 33, 33]]
5757
expected_sizes = [[15], [1024], [10976, 10976], [8160], [8000],
5858
[35937, 35937, 35937, 35937, 35937, 35937]]
5959

60-
self.check_split_output(shapes, expected_sizes, 8192)
60+
self.check_slice_output(shapes, expected_sizes, 8192)
6161

6262

6363
if __name__ == '__main__':

0 commit comments

Comments
 (0)