Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
842fd293
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
842fd293
编写于
11月 23, 2020
作者:
Z
Zhang Ting
提交者:
GitHub
11月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove fluid in default_main_program doc, test=document_fix (#28941)
上级
71c1cd14
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
8 addition
and
27 deletion
+8
-27
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+8
-27
未找到文件。
python/paddle/fluid/framework.py
浏览文件 @
842fd293
...
@@ -5400,7 +5400,7 @@ def default_main_program():
...
@@ -5400,7 +5400,7 @@ def default_main_program():
This API can be used to get ``default main program`` which store the
This API can be used to get ``default main program`` which store the
descriptions of Ops and tensors.
descriptions of Ops and tensors.
For example ``z = paddle.
fluid.layers.elementwise_add(x, y)`` will create a new ``elementwise_
add``
For example ``z = paddle.
add(x, y)`` will create a new ``
add``
Op and a new ``z`` tensor, and they will be recorded in ``default main program`` .
Op and a new ``z`` tensor, and they will be recorded in ``default main program`` .
The ``default main program`` is the default value for ``Program`` parameter in
The ``default main program`` is the default value for ``Program`` parameter in
...
@@ -5419,33 +5419,14 @@ def default_main_program():
...
@@ -5419,33 +5419,14 @@ def default_main_program():
paddle.enable_static()
paddle.enable_static()
# Sample Network:
# Sample Network:
data = paddle.static.data(name='image', shape=[None, 3, 224, 224], dtype='float32')
x = paddle.static.data(name='x', shape=[100, 100], dtype='float32')
label = paddle.static.data(name='label', shape=[None, 1], dtype='int64')
y = paddle.static.data(name='x', shape=[100, 100], dtype='float32')
out = paddle.add(x, y)
conv1 = paddle.static.nn.conv2d(data, 4, 5, 1, act=None)
bn1 = paddle.static.nn.batch_norm(conv1, act='relu')
pool1 = paddle.fluid.layers.pool2d(bn1, 2, 'max', 2)
conv2 = paddle.static.nn.conv2d(pool1, 16, 5, 1, act=None)
bn2 = paddle.static.nn.batch_norm(conv2, act='relu')
pool2 = paddle.fluid.layers.pool2d(bn2, 2, 'max', 2)
fc1 = paddle.static.nn.fc(x=pool2, size=50, activation='relu')
fc2 = paddle.static.nn.fc(x=fc1, size=102, activation='softmax')
loss = paddle.nn.functional.loss.cross_entropy(input=fc2, label=label)
loss = paddle.mean(loss)
opt = paddle.optimizer.Momentum(
learning_rate=0.1,
momentum=0.9,
weight_decay=paddle.regularizer.L2Decay(1e-4))
opt.minimize(loss)
#print the number of blocks in the program, 1 in this case
#print the number of blocks in the program, 1 in this case
print(paddle.static.default_main_program().num_blocks) #[1]
print(paddle.static.default_main_program().num_blocks) # 1
#print the default_main_program
#print the description of variable 'image'
print(paddle.static.default_main_program())
print(paddle.static.default_main_program())
"""
"""
return
_main_program_
return
_main_program_
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录