diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index d31b434103205a920ef8a83bf87f912b93d292ed..aaceb22b98dff58c03871d97f173fad88a9449df 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -543,7 +543,7 @@ def name_scope(prefix=None): import paddle paddle.enable_static() with paddle.static.name_scope("s1"): - a = paddle.fluid.data(name='data', shape=[None, 1], dtype='int32') + a = paddle.static.data(name='data', shape=[None, 1], dtype='int32') b = a + 1 with paddle.static.name_scope("s2"): c = b * 1 @@ -5357,8 +5357,8 @@ def default_startup_program(): main_program = paddle.static.Program() startup_program = paddle.static.Program() with paddle.static.program_guard(main_program=main_program, startup_program=startup_program): - x = paddle.fluid.data(name="x", shape=[-1, 784], dtype='float32') - y = paddle.fluid.data(name="y", shape=[-1, 1], dtype='int32') + x = paddle.static.data(name="x", shape=[-1, 784], dtype='float32') + y = paddle.static.data(name="y", shape=[-1, 1], dtype='int32') z = paddle.static.nn.fc(name="fc", x=x, size=10, activation="relu") print("main program is: {}".format(paddle.static.default_main_program())) @@ -5391,8 +5391,8 @@ def default_main_program(): paddle.enable_static() # Sample Network: - data = paddle.fluid.data(name='image', shape=[None, 3, 224, 224], dtype='float32') - label = paddle.fluid.data(name='label', shape=[None, 1], dtype='int64') + data = paddle.static.data(name='image', shape=[None, 3, 224, 224], dtype='float32') + label = paddle.static.data(name='label', shape=[None, 1], dtype='int64') conv1 = paddle.static.nn.conv2d(data, 4, 5, 1, act=None) bn1 = paddle.static.nn.batch_norm(conv1, act='relu') diff --git a/python/paddle/nn/functional/input.py b/python/paddle/nn/functional/input.py index b22a3bd1be4584d9882db3389c0f13af4b274560..2e4bbd99a726d7c85fb18054e75b1c3cbcfaf394 100644 --- a/python/paddle/nn/functional/input.py +++ b/python/paddle/nn/functional/input.py @@ -74,7 +74,7 @@ def one_hot(x, num_classes, name=None): import paddle # Correspond to the first example above, where label.shape is 4 and one_hot_label.shape is [4, 4]. - label = paddle.fluid.data(name="label", shape=[4, 1], dtype="int64") + label = paddle.static.data(name="label", shape=[4, 1], dtype="int64") # label.shape = [4] # label.data = [1, 1, 3, 0] one_hot_label = paddle.nn.functional.one_hot(x=label, num_classes=4) @@ -183,7 +183,7 @@ def embedding(x, weight, padding_idx=None, sparse=False, name=None): weight = prog.global_block().create_parameter( (128, 100), dtype="float32", default_initializer=Constant(1.0)) - label = paddle.fluid.data( + label = paddle.static.data( name="label", shape=[4], append_batch_size=False,