Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
44e57b3c
提交
44e57b3c
authored
7月 10, 2012
作者:
David Warde-Farley
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #752 from goodfeli/rename_env
Rename env
上级
bb96a1ad
5c59cec8
全部展开
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
28 行增加
和
24 行删除
+28
-24
pipeline.txt
doc/extending/pipeline.txt
+8
-7
debugmode.py
theano/compile/debugmode.py
+2
-2
function_module.py
theano/compile/function_module.py
+1
-1
__init__.py
theano/gof/__init__.py
+4
-2
destroyhandler.py
theano/gof/destroyhandler.py
+1
-1
fg.py
theano/gof/fg.py
+0
-0
op.py
theano/gof/op.py
+1
-1
opt.py
theano/gof/opt.py
+2
-2
test_cc.py
theano/gof/tests/test_cc.py
+3
-2
test_destroyhandler.py
theano/gof/tests/test_destroyhandler.py
+1
-1
test_link.py
theano/gof/tests/test_link.py
+2
-2
test_opt.py
theano/gof/tests/test_opt.py
+1
-1
test_toolbox.py
theano/gof/tests/test_toolbox.py
+1
-1
test_merge.py
theano/tensor/tests/test_merge.py
+1
-1
没有找到文件。
doc/extending/pipeline.txt
浏览文件 @
44e57b3c
...
@@ -36,32 +36,32 @@ Here is an overview of the various steps that are done with the
...
@@ -36,32 +36,32 @@ Here is an overview of the various steps that are done with the
computation graph in the compilation phase:
computation graph in the compilation phase:
Step 1 - Create a
n Env
Step 1 - Create a
FunctionGraph
^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^
The subgraph given by the end user is wrapped in a structure called
The subgraph given by the end user is wrapped in a structure called
*
Env
*. That structure defines several hooks on adding and
*
FunctionGraph
*. That structure defines several hooks on adding and
removing (pruning) nodes as well as on modifying links between nodes
removing (pruning) nodes as well as on modifying links between nodes
(for example, modifying an input of an :ref:`apply` node) (see the
(for example, modifying an input of an :ref:`apply` node) (see the
article about :ref:`libdoc_gof_env` for more information).
article about :ref:`libdoc_gof_env` for more information).
Env
provides a method to change the input of an Apply node from one
FunctionGraph
provides a method to change the input of an Apply node from one
Variable to another and a more high-level method to replace a Variable
Variable to another and a more high-level method to replace a Variable
with another. This is the structure that :ref:`Optimizers
with another. This is the structure that :ref:`Optimizers
<optimization>` work on.
<optimization>` work on.
Some relevant :ref:`Features <libdoc_gof_envfeature>` are typically added to the
Some relevant :ref:`Features <libdoc_gof_envfeature>` are typically added to the
Env
, namely to prevent any optimization from operating inplace on
FunctionGraph
, namely to prevent any optimization from operating inplace on
inputs declared as immutable.
inputs declared as immutable.
Step 2 - Execute main Optimizer
Step 2 - Execute main Optimizer
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Once the
Env
is made, an :term:`optimizer` is produced
Once the
FunctionGraph
is made, an :term:`optimizer` is produced
by the :term:`mode` passed to ``function`` or to the Method/Module's
by the :term:`mode` passed to ``function`` or to the Method/Module's
``make`` (the Mode basically has two important fields, ``linker`` and
``make`` (the Mode basically has two important fields, ``linker`` and
``optimizer``). That optimizer is applied on the
Env
using its
``optimizer``). That optimizer is applied on the
FunctionGraph
using its
optimize() method.
optimize() method.
The optimizer is typically obtained through :attr:`optdb`.
The optimizer is typically obtained through :attr:`optdb`.
...
@@ -71,7 +71,8 @@ Step 3 - Execute linker to obtain a thunk
...
@@ -71,7 +71,8 @@ Step 3 - Execute linker to obtain a thunk
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Once the computation graph is optimized, the :term:`linker` is
Once the computation graph is optimized, the :term:`linker` is
extracted from the Mode. It is then called with the Env as argument to
extracted from the Mode. It is then called with the FunctionGraph as
argument to
produce a ``thunk``, which is a function with no arguments that
produce a ``thunk``, which is a function with no arguments that
returns nothing. Along with the thunk, one list of input containers (a
returns nothing. Along with the thunk, one list of input containers (a
theano.gof.Container is a sort of object that wraps another and does
theano.gof.Container is a sort of object that wraps another and does
...
...
theano/compile/debugmode.py
浏览文件 @
44e57b3c
...
@@ -13,7 +13,7 @@ import numpy
...
@@ -13,7 +13,7 @@ import numpy
import
theano
import
theano
from
theano
import
gof
from
theano
import
gof
from
theano.gof
import
Env
,
graph
,
utils
,
link
,
ops_with_inner_function
from
theano.gof
import
FunctionGraph
as
Env
,
graph
,
utils
,
link
,
ops_with_inner_function
from
theano.gof.link
import
raise_with_op
from
theano.gof.link
import
raise_with_op
from
theano.gof.cc
import
CLinker
from
theano.gof.cc
import
CLinker
from
theano.gof.python25
import
all
,
any
,
product
as
itertools_product
from
theano.gof.python25
import
all
,
any
,
product
as
itertools_product
...
@@ -667,7 +667,7 @@ def _optcheck_env(input_specs, output_specs, accept_inplace=False):
...
@@ -667,7 +667,7 @@ def _optcheck_env(input_specs, output_specs, accept_inplace=False):
inputs
,
outputs
=
gof
.
graph
.
clone
(
orig_inputs
,
orig_outputs
)
inputs
,
outputs
=
gof
.
graph
.
clone
(
orig_inputs
,
orig_outputs
)
equivalence_tracker
=
_VariableEquivalenceTracker
()
equivalence_tracker
=
_VariableEquivalenceTracker
()
env
=
gof
.
env
.
Env
(
inputs
,
outputs
,
env
=
gof
.
fg
.
FunctionGraph
(
inputs
,
outputs
,
#DestroyHandler is not needed because it is actually installed by an optimization
#DestroyHandler is not needed because it is actually installed by an optimization
# after canonicalization. This variables in a big speed gain.
# after canonicalization. This variables in a big speed gain.
#features=[equivalence_tracker, gof.DestroyHandler(do_imports_on_attach=False)])
#features=[equivalence_tracker, gof.DestroyHandler(do_imports_on_attach=False)])
...
...
theano/compile/function_module.py
浏览文件 @
44e57b3c
...
@@ -129,7 +129,7 @@ def std_env(input_specs, output_specs, accept_inplace = False):
...
@@ -129,7 +129,7 @@ def std_env(input_specs, output_specs, accept_inplace = False):
orig_outputs
=
[
spec
.
variable
for
spec
in
output_specs
]
+
updates
orig_outputs
=
[
spec
.
variable
for
spec
in
output_specs
]
+
updates
inputs
,
outputs
=
gof
.
graph
.
clone
(
orig_inputs
,
orig_outputs
)
inputs
,
outputs
=
gof
.
graph
.
clone
(
orig_inputs
,
orig_outputs
)
env
=
gof
.
env
.
Env
(
inputs
,
outputs
)
env
=
gof
.
fg
.
FunctionGraph
(
inputs
,
outputs
)
for
node
in
env
.
nodes
:
for
node
in
env
.
nodes
:
if
getattr
(
node
.
op
,
'destroy_map'
,
None
):
if
getattr
(
node
.
op
,
'destroy_map'
,
None
):
...
...
theano/gof/__init__.py
浏览文件 @
44e57b3c
...
@@ -42,8 +42,10 @@ from cc import \
...
@@ -42,8 +42,10 @@ from cc import \
import
compiledir
# adds config vars
import
compiledir
# adds config vars
from
env
import
\
from
fg
import
\
InconsistencyError
,
MissingInputError
,
Env
InconsistencyError
,
MissingInputError
,
FunctionGraph
#deprecated alias to support code written with old name
Env
=
FunctionGraph
from
destroyhandler
import
\
from
destroyhandler
import
\
DestroyHandler
DestroyHandler
...
...
theano/gof/destroyhandler.py
浏览文件 @
44e57b3c
...
@@ -10,7 +10,7 @@ import toolbox
...
@@ -10,7 +10,7 @@ import toolbox
import
graph
import
graph
from
theano.gof.python25
import
deque
from
theano.gof.python25
import
deque
from
env
import
InconsistencyError
from
fg
import
InconsistencyError
class
ProtocolError
(
Exception
):
class
ProtocolError
(
Exception
):
"""WRITEME"""
"""WRITEME"""
...
...
theano/gof/
env
.py
→
theano/gof/
fg
.py
浏览文件 @
44e57b3c
差异被折叠。
点击展开。
theano/gof/op.py
浏览文件 @
44e57b3c
...
@@ -21,7 +21,7 @@ from theano import config
...
@@ -21,7 +21,7 @@ from theano import config
import
cc
import
cc
import
graph
import
graph
import
utils
import
utils
from
env
import
Env
from
fg
import
FunctionGraph
as
Env
class
CLinkerObject
(
object
):
class
CLinkerObject
(
object
):
...
...
theano/gof/opt.py
浏览文件 @
44e57b3c
...
@@ -11,7 +11,7 @@ import time
...
@@ -11,7 +11,7 @@ import time
import
numpy
import
numpy
import
graph
import
graph
from
env
import
InconsistencyError
from
fg
import
InconsistencyError
import
op
import
op
import
utils
import
utils
import
unify
import
unify
...
@@ -598,7 +598,7 @@ def is_same_graph_with_merge(var1, var2, givens=None):
...
@@ -598,7 +598,7 @@ def is_same_graph_with_merge(var1, var2, givens=None):
givens
=
copied
[
2
]
givens
=
copied
[
2
]
# Create Env.
# Create Env.
inputs
=
theano
.
gof
.
graph
.
inputs
(
vars
)
inputs
=
theano
.
gof
.
graph
.
inputs
(
vars
)
env
=
theano
.
gof
.
env
.
Env
(
inputs
,
vars
)
env
=
theano
.
gof
.
fg
.
FunctionGraph
(
inputs
,
vars
)
# Perform Variable substitution.
# Perform Variable substitution.
for
to_replace
,
replace_by
in
givens
.
iteritems
():
for
to_replace
,
replace_by
in
givens
.
iteritems
():
env
.
replace
(
to_replace
,
replace_by
)
env
.
replace
(
to_replace
,
replace_by
)
...
...
theano/gof/tests/test_cc.py
浏览文件 @
44e57b3c
...
@@ -6,7 +6,8 @@ from theano.gof.cc import *
...
@@ -6,7 +6,8 @@ from theano.gof.cc import *
from
theano.gof.type
import
Type
from
theano.gof.type
import
Type
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.op
import
Op
from
theano.gof.op
import
Op
from
theano.gof
import
env
from
theano.gof
import
fg
env
=
fg
from
theano.gof
import
toolbox
from
theano.gof
import
toolbox
...
@@ -171,7 +172,7 @@ def inputs():
...
@@ -171,7 +172,7 @@ def inputs():
def
Env
(
inputs
,
outputs
):
def
Env
(
inputs
,
outputs
):
e
=
env
.
Env
(
inputs
,
outputs
)
e
=
fg
.
FunctionGraph
(
inputs
,
outputs
)
return
e
return
e
...
...
theano/gof/tests/test_destroyhandler.py
浏览文件 @
44e57b3c
...
@@ -8,7 +8,7 @@ from theano.gof.op import Op
...
@@ -8,7 +8,7 @@ from theano.gof.op import Op
from
theano.gof.opt
import
*
from
theano.gof.opt
import
*
from
theano.gof
import
destroyhandler
from
theano.gof
import
destroyhandler
from
theano.gof.
env
import
Env
,
InconsistencyError
from
theano.gof.
fg
import
FunctionGraph
as
Env
,
InconsistencyError
from
theano.gof.toolbox
import
ReplaceValidate
from
theano.gof.toolbox
import
ReplaceValidate
from
copy
import
copy
from
copy
import
copy
...
...
theano/gof/tests/test_link.py
浏览文件 @
44e57b3c
...
@@ -4,7 +4,7 @@ from theano.gof import graph
...
@@ -4,7 +4,7 @@ from theano.gof import graph
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.type
import
Type
from
theano.gof.type
import
Type
from
theano.gof.op
import
Op
from
theano.gof.op
import
Op
from
theano.gof
import
env
from
theano.gof
import
fg
from
theano.gof
import
toolbox
from
theano.gof
import
toolbox
from
theano.gof.link
import
*
from
theano.gof.link
import
*
...
@@ -75,7 +75,7 @@ def perform_linker(env):
...
@@ -75,7 +75,7 @@ def perform_linker(env):
def
Env
(
inputs
,
outputs
):
def
Env
(
inputs
,
outputs
):
e
=
env
.
Env
(
inputs
,
outputs
)
e
=
fg
.
FunctionGraph
(
inputs
,
outputs
)
return
e
return
e
...
...
theano/gof/tests/test_opt.py
浏览文件 @
44e57b3c
...
@@ -3,7 +3,7 @@ from theano.gof.type import Type
...
@@ -3,7 +3,7 @@ from theano.gof.type import Type
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.op
import
Op
from
theano.gof.op
import
Op
from
theano.gof.opt
import
*
from
theano.gof.opt
import
*
from
theano.gof.
env
import
Env
from
theano.gof.
fg
import
FunctionGraph
as
Env
from
theano.gof.toolbox
import
*
from
theano.gof.toolbox
import
*
...
...
theano/gof/tests/test_toolbox.py
浏览文件 @
44e57b3c
...
@@ -3,7 +3,7 @@ from theano.gof.graph import Variable, Apply
...
@@ -3,7 +3,7 @@ from theano.gof.graph import Variable, Apply
from
theano.gof.type
import
Type
from
theano.gof.type
import
Type
from
theano.gof.op
import
Op
from
theano.gof.op
import
Op
from
theano.gof.
env
import
Env
,
InconsistencyError
from
theano.gof.
fg
import
FunctionGraph
as
Env
,
InconsistencyError
from
theano.gof.toolbox
import
*
from
theano.gof.toolbox
import
*
...
...
theano/tensor/tests/test_merge.py
浏览文件 @
44e57b3c
...
@@ -3,7 +3,7 @@ from theano.gof.type import Type
...
@@ -3,7 +3,7 @@ from theano.gof.type import Type
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.op
import
Op
from
theano.gof.op
import
Op
from
theano.gof.opt
import
*
from
theano.gof.opt
import
*
from
theano.gof.
env
import
Env
from
theano.gof.
fg
import
FunctionGraph
as
Env
from
theano.gof.toolbox
import
*
from
theano.gof.toolbox
import
*
import
theano.tensor.basic
as
T
import
theano.tensor.basic
as
T
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论