Skip to content

Commit cef1fb9

Browse files
committed
Tensor parallel: update unitest
1 parent 7bc90e4 commit cef1fb9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

python/paddle/distributed/collective.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ def _parallel_linear(x,
10141014
startup_block.vars[linear.weight.name].is_distributed = True
10151015
main_block.vars[linear.weight.name].is_distributed = True
10161016
# set is_distributed for splited bias
1017-
# if a linear layer is splited by row, each rank would hold a complete bias
1017+
# if a linear layer is splited by row, each rank would hold a complete bias and they should be the same in each rank.
10181018
# if a linear layer is splited by col, the bias would also be split into each rank as its weight
10191019
if axis == 1 and linear._bias_attr != False:
10201020
startup_block.vars[linear.bias.name].is_distributed = True

python/paddle/fluid/tests/unittests/column_parallel_linear_api.py

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def get_model(self, main_prog, startup_program, rank):
6969
axis=1,
7070
num_partitions=2,
7171
weight_attr=param_attr,
72-
bias_attr=False, )
72+
bias_attr=True, )
7373

7474
return [linear_out]
7575

python/paddle/fluid/tests/unittests/row_parallel_linear_api.py

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ def get_model(self, main_prog, startup_program, rank):
6565

6666
linear_out = paddle.distributed.split(
6767
data,
68-
size=(1000, 8),
68+
size=(1000, 16),
6969
operation='linear',
7070
axis=0,
7171
num_partitions=2,
7272
weight_attr=param_attr,
73-
bias_attr=False, )
73+
bias_attr=True, )
7474

7575
return [linear_out]
7676

0 commit comments

Comments
 (0)