Skip to content

Commit

Permalink
[Auto Parallel] Restore the test_program.py
Browse files Browse the repository at this point in the history
  • Loading branch information
aoyulong committed Sep 13, 2022
1 parent 6b1fed1 commit 23f6539
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions python/paddle/fluid/tests/unittests/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
import paddle
import paddle.fluid.layers as layers
import paddle.fluid as fluid
import numpy as np

paddle.enable_static()

main_program = default_main_program()

Expand Down Expand Up @@ -233,14 +230,15 @@ def test_update_var(self):
b = program.desc.serialize_to_string()
self.assertFalse(a == b)

# it seems the attrs of framework::VarDesc is not write to proto,
# except for persistable/need_check_feed/is_parameter/stop_gradient
def test_update_var_attr(self):
program = build_program()
a = program.desc.serialize_to_string()
# Only int, string or list of int can be accepted by _set_attr
program.current_block().var("x").desc._set_attr("a", 1)
self.assertTrue(program.desc.need_update())
self.assertFalse(program.desc.need_update())
b = program.desc.serialize_to_string()
self.assertFalse(a == b) # not affected
self.assertTrue(a == b) # not affected


class TestProgramHash(unittest.TestCase):
Expand Down

0 comments on commit 23f6539

Please sign in to comment.