Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
77866eff
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
77866eff
编写于
10月 16, 2020
作者:
C
chentianyu03
提交者:
GitHub
10月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change paddle.fluid.data to paddle.static.data in sample code (#27992) (#28014)
上级
cafa35e1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
7 deletion
+7
-7
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+5
-5
python/paddle/nn/functional/input.py
python/paddle/nn/functional/input.py
+2
-2
未找到文件。
python/paddle/fluid/framework.py
浏览文件 @
77866eff
...
@@ -543,7 +543,7 @@ def name_scope(prefix=None):
...
@@ -543,7 +543,7 @@ def name_scope(prefix=None):
import paddle
import paddle
paddle.enable_static()
paddle.enable_static()
with paddle.static.name_scope("s1"):
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
b = a + 1
with paddle.static.name_scope("s2"):
with paddle.static.name_scope("s2"):
c = b * 1
c = b * 1
...
@@ -5357,8 +5357,8 @@ def default_startup_program():
...
@@ -5357,8 +5357,8 @@ def default_startup_program():
main_program = paddle.static.Program()
main_program = paddle.static.Program()
startup_program = paddle.static.Program()
startup_program = paddle.static.Program()
with paddle.static.program_guard(main_program=main_program, startup_program=startup_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')
x = paddle.
static
.data(name="x", shape=[-1, 784], dtype='float32')
y = paddle.
fluid
.data(name="y", shape=[-1, 1], dtype='int32')
y = paddle.
static
.data(name="y", shape=[-1, 1], dtype='int32')
z = paddle.static.nn.fc(name="fc", x=x, size=10, activation="relu")
z = paddle.static.nn.fc(name="fc", x=x, size=10, activation="relu")
print("main program is: {}".format(paddle.static.default_main_program()))
print("main program is: {}".format(paddle.static.default_main_program()))
...
@@ -5391,8 +5391,8 @@ def default_main_program():
...
@@ -5391,8 +5391,8 @@ def default_main_program():
paddle.enable_static()
paddle.enable_static()
# Sample Network:
# Sample Network:
data = paddle.
fluid
.data(name='image', shape=[None, 3, 224, 224], dtype='float32')
data = paddle.
static
.data(name='image', shape=[None, 3, 224, 224], dtype='float32')
label = paddle.
fluid
.data(name='label', shape=[None, 1], dtype='int64')
label = paddle.
static
.data(name='label', shape=[None, 1], dtype='int64')
conv1 = paddle.static.nn.conv2d(data, 4, 5, 1, act=None)
conv1 = paddle.static.nn.conv2d(data, 4, 5, 1, act=None)
bn1 = paddle.static.nn.batch_norm(conv1, act='relu')
bn1 = paddle.static.nn.batch_norm(conv1, act='relu')
...
...
python/paddle/nn/functional/input.py
浏览文件 @
77866eff
...
@@ -74,7 +74,7 @@ def one_hot(x, num_classes, name=None):
...
@@ -74,7 +74,7 @@ def one_hot(x, num_classes, name=None):
import paddle
import paddle
# Correspond to the first example above, where label.shape is 4 and one_hot_label.shape is [4, 4].
# 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.shape = [4]
# label.data = [1, 1, 3, 0]
# label.data = [1, 1, 3, 0]
one_hot_label = paddle.nn.functional.one_hot(x=label, num_classes=4)
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):
...
@@ -183,7 +183,7 @@ def embedding(x, weight, padding_idx=None, sparse=False, name=None):
weight = prog.global_block().create_parameter(
weight = prog.global_block().create_parameter(
(128, 100), dtype="float32", default_initializer=Constant(1.0))
(128, 100), dtype="float32", default_initializer=Constant(1.0))
label = paddle.
fluid
.data(
label = paddle.
static
.data(
name="label",
name="label",
shape=[4],
shape=[4],
append_batch_size=False,
append_batch_size=False,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录