Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
0690a9fb
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0690a9fb
编写于
3月 27, 2017
作者:
Q
qijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add v2 run logic doc
上级
c36bf197
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
3 deletion
+30
-3
doc/api/v2/run_logic.rst
doc/api/v2/run_logic.rst
+4
-0
python/paddle/v2/inference.py
python/paddle/v2/inference.py
+11
-1
python/paddle/v2/trainer.py
python/paddle/v2/trainer.py
+15
-2
未找到文件。
doc/api/v2/run_logic.rst
浏览文件 @
0690a9fb
...
...
@@ -6,22 +6,26 @@ Parameters
==========
.. automodule:: paddle.v2.parameters
:members: Parameters
:noindex:
Trainer
=======
.. automodule:: paddle.v2.trainer
:members: Trainer
:noindex:
Event
=====
.. automodule:: paddle.v2.event
:members: Event
:noindex:
Inference
=========
.. autofunction:: paddle.v2.infer
:members: Inference
:noindex:
python/paddle/v2/inference.py
浏览文件 @
0690a9fb
...
...
@@ -9,6 +9,16 @@ __all__ = ['infer']
class
Inference
(
object
):
"""
Inference combines neural network output and parameters together
to do inference.
:param outptut_layer: The neural network that should be inferenced.
:type output_layer: paddle.v2.config_base.Layer or the sequence
of paddle.v2.config_base.Layer
:param parameters: The parameters dictionary.
:type parameters: paddle.v2.parameters.Parameters
"""
def
__init__
(
self
,
output_layer
,
parameters
):
topo
=
topology
.
Topology
(
output_layer
)
gm
=
api
.
GradientMachine
.
createFromConfigProto
(
...
...
@@ -39,7 +49,7 @@ class Inference(object):
def
iter_infer_field
(
self
,
field
,
**
kwargs
):
for
result
in
self
.
iter_infer
(
**
kwargs
):
yield
[
each_result
[
field
]
for
each_result
in
result
]
def
infer
(
self
,
field
=
'value'
,
**
kwargs
):
retv
=
None
for
result
in
self
.
iter_infer_field
(
field
=
field
,
**
kwargs
):
...
...
python/paddle/v2/trainer.py
浏览文件 @
0690a9fb
...
...
@@ -29,7 +29,8 @@ def default_event_handler(event):
class
SGD
(
object
):
"""
Simple SGD Trainer.
TODO(yuyang18): Complete comments
SGD Trainer combines data reader, network topolopy and update_equation together
to train/test a neural network.
:param update_equation: The optimizer object.
:type update_equation: paddle.v2.optimizer.Optimizer
...
...
@@ -65,7 +66,9 @@ class SGD(object):
"""
Training method. Will train num_passes of input data.
:param reader:
:param reader: A reader that reads and yeilds data items. Usually we use a
batched reader to do mini-batch training.
:type reader: collections.Iterable
:param num_passes: The total train passes.
:param event_handler: Event handler. A method will be invoked when event
occurred.
...
...
@@ -123,6 +126,16 @@ class SGD(object):
self
.
__gradient_machine__
.
finish
()
def
test
(
self
,
reader
,
feeding
=
None
):
"""
Testing method. Will test input data.
:param reader: A reader that reads and yeilds data items.
:type reader: collections.Iterable
:param feeding: Feeding is a map of neural network input name and array
index that reader returns.
:type feeding: dict
:return:
"""
feeder
=
DataFeeder
(
self
.
__data_types__
,
feeding
)
evaluator
=
self
.
__gradient_machine__
.
makeEvaluator
()
out_args
=
api
.
Arguments
.
createArguments
(
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录