Skip to content

Commit

Permalink
[Cleanup][C-17] clean some random_seed for test (#61504)
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooo-create authored Feb 5, 2024
1 parent c6bf967 commit d6ccece
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 38 deletions.
15 changes: 3 additions & 12 deletions test/ir/inference/test_trt_conv_quant_dequant_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down Expand Up @@ -175,10 +172,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down Expand Up @@ -283,10 +277,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down
15 changes: 3 additions & 12 deletions test/ir/inference/test_trt_fc_fuse_quant_dequant_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down Expand Up @@ -124,10 +121,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down Expand Up @@ -200,10 +194,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down
15 changes: 3 additions & 12 deletions test/ir/inference/test_trt_matmul_quant_dequant.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down Expand Up @@ -171,10 +168,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down Expand Up @@ -282,10 +276,7 @@ def network():
avg_loss = paddle.mean(loss)
return avg_loss, result

self.main_program.random_seed = 2
self.startup_program.random_seed = 2
self.test_main_program.random_seed = 2
# self.test_startup_program.random_seed = 2
paddle.seed(2)
with base.unique_name.guard():
with base.program_guard(self.main_program, self.startup_program):
self.loss, result = network()
Expand Down
3 changes: 1 addition & 2 deletions test/legacy_test/test_static_save_load_bf16.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ def test_ptb_rnn_cpu_bfloat16(self):
batch_num = 100

with new_program_scope():
base.default_startup_program().random_seed = seed
base.default_main_program().random_seed = seed
paddle.seed(seed)
ptb_model = PtbModel(
"ptb_model",
hidden_size=hidden_size,
Expand Down

0 comments on commit d6ccece

Please sign in to comment.