Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
27448332
提交
27448332
authored
12月 20, 2020
作者:
Michael Osthege
提交者:
Brandon T. Willard
12月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove automatic package-level imports from theano.link
上级
1d5236be
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
28 行增加
和
35 行删除
+28
-35
pipeline.txt
doc/extending/pipeline.txt
+1
-1
__init__.py
theano/__init__.py
+2
-2
debugmode.py
theano/compile/debugmode.py
+7
-7
types.py
theano/compile/function/types.py
+11
-9
io.py
theano/compile/io.py
+2
-4
sharedvalue.py
theano/compile/sharedvalue.py
+1
-1
__init__.py
theano/link/__init__.py
+2
-9
__init__.py
theano/link/c/__init__.py
+0
-1
jax_linker.py
theano/link/jax/jax_linker.py
+2
-1
没有找到文件。
doc/extending/pipeline.txt
浏览文件 @
27448332
...
@@ -73,7 +73,7 @@ extracted from the Mode. It is then called with the FunctionGraph as
...
@@ -73,7 +73,7 @@ extracted from the Mode. It is then called with the FunctionGraph as
argument to
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.link.Container is a sort of object that wraps another and does
theano.link.
basic.
Container is a sort of object that wraps another and does
type casting) and one list of output containers are produced,
type casting) and one list of output containers are produced,
corresponding to the input and output Variables as well as the updates
corresponding to the input and output Variables as well as the updates
defined for the inputs when applicable. To perform the computations,
defined for the inputs when applicable. To perform the computations,
...
...
theano/__init__.py
浏览文件 @
27448332
...
@@ -114,8 +114,8 @@ from theano.gof import (
...
@@ -114,8 +114,8 @@ from theano.gof import (
utils
,
utils
,
)
)
from
theano.gradient
import
Lop
,
Rop
,
grad
,
subgraph_grad
from
theano.gradient
import
Lop
,
Rop
,
grad
,
subgraph_grad
from
theano.link
import
Container
,
Linker
,
LocalLinker
,
PerformLinker
from
theano.link
.basic
import
Container
,
Linker
,
LocalLinker
,
PerformLinker
from
theano.link.c
import
CLinker
,
DualLinker
,
OpWiseCLinker
from
theano.link.c
.cc
import
CLinker
,
DualLinker
,
OpWiseCLinker
from
theano.misc.safe_asarray
import
_asarray
from
theano.misc.safe_asarray
import
_asarray
from
theano.printing
import
pp
,
pprint
from
theano.printing
import
pp
,
pprint
from
theano.updates
import
OrderedUpdates
from
theano.updates
import
OrderedUpdates
...
...
theano/compile/debugmode.py
浏览文件 @
27448332
...
@@ -18,7 +18,7 @@ from warnings import warn
...
@@ -18,7 +18,7 @@ from warnings import warn
import
numpy
as
np
import
numpy
as
np
import
theano
import
theano
from
theano
import
config
,
gof
,
link
from
theano
import
config
,
gof
from
theano.compile.function.types
import
(
from
theano.compile.function.types
import
(
Function
,
Function
,
FunctionMaker
,
FunctionMaker
,
...
@@ -28,8 +28,8 @@ from theano.compile.function.types import (
...
@@ -28,8 +28,8 @@ from theano.compile.function.types import (
from
theano.compile.mode
import
Mode
,
register_mode
from
theano.compile.mode
import
Mode
,
register_mode
from
theano.compile.ops
import
OutputGuard
,
_output_guard
from
theano.compile.ops
import
OutputGuard
,
_output_guard
from
theano.gof
import
graph
,
ops_with_inner_function
,
utils
from
theano.gof
import
graph
,
ops_with_inner_function
,
utils
from
theano.link.basic
import
LocalLinker
from
theano.link.basic
import
Container
,
LocalLinker
from
theano.link.utils
import
raise_with_op
from
theano.link.utils
import
map_storage
,
raise_with_op
from
theano.utils
import
get_unbound_function
from
theano.utils
import
get_unbound_function
...
@@ -1793,7 +1793,7 @@ class _Linker(LocalLinker):
...
@@ -1793,7 +1793,7 @@ class _Linker(LocalLinker):
# the function's outputs will always be freshly allocated.
# the function's outputs will always be freshly allocated.
no_recycling
=
[]
no_recycling
=
[]
input_storage
,
output_storage
,
storage_map
=
theano
.
link
.
map_storage
(
input_storage
,
output_storage
,
storage_map
=
map_storage
(
fgraph
,
order
,
input_storage_
,
output_storage_
,
storage_map
fgraph
,
order
,
input_storage_
,
output_storage_
,
storage_map
)
)
...
@@ -2341,11 +2341,11 @@ class _Linker(LocalLinker):
...
@@ -2341,11 +2341,11 @@ class _Linker(LocalLinker):
return
(
return
(
f
,
f
,
[
[
link
.
Container
(
input
,
storage
,
readonly
=
False
)
Container
(
input
,
storage
,
readonly
=
False
)
for
input
,
storage
in
zip
(
fgraph
.
inputs
,
input_storage
)
for
input
,
storage
in
zip
(
fgraph
.
inputs
,
input_storage
)
],
],
[
[
link
.
Container
(
output
,
storage
,
readonly
=
True
)
Container
(
output
,
storage
,
readonly
=
True
)
for
output
,
storage
in
zip
(
fgraph
.
outputs
,
output_storage
)
for
output
,
storage
in
zip
(
fgraph
.
outputs
,
output_storage
)
],
],
thunks_py
,
thunks_py
,
...
@@ -2566,7 +2566,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
...
@@ -2566,7 +2566,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
self
.
refeed
=
[
self
.
refeed
=
[
(
(
i
.
value
is
not
None
i
.
value
is
not
None
and
not
isinstance
(
i
.
value
,
link
.
Container
)
and
not
isinstance
(
i
.
value
,
Container
)
and
i
.
update
is
None
and
i
.
update
is
None
)
)
for
i
in
self
.
inputs
for
i
in
self
.
inputs
...
...
theano/compile/function/types.py
浏览文件 @
27448332
...
@@ -15,12 +15,14 @@ import numpy as np
...
@@ -15,12 +15,14 @@ import numpy as np
import
theano
import
theano
import
theano.compile.profiling
import
theano.compile.profiling
from
theano
import
config
,
gof
,
link
from
theano
import
config
,
gof
from
theano.compile.io
import
In
,
SymbolicInput
,
SymbolicOutput
from
theano.compile.io
import
In
,
SymbolicInput
,
SymbolicOutput
from
theano.compile.ops
import
deep_copy_op
,
view_op
from
theano.compile.ops
import
deep_copy_op
,
view_op
from
theano.gof
import
graph
from
theano.gof
import
graph
from
theano.gof.op
import
ops_with_inner_function
from
theano.gof.op
import
ops_with_inner_function
from
theano.gof.toolbox
import
is_same_graph
from
theano.gof.toolbox
import
is_same_graph
from
theano.link.basic
import
Container
from
theano.link.utils
import
raise_with_op
_logger
=
logging
.
getLogger
(
"theano.compile.function.types"
)
_logger
=
logging
.
getLogger
(
"theano.compile.function.types"
)
...
@@ -440,7 +442,7 @@ class Function:
...
@@ -440,7 +442,7 @@ class Function:
if
value
is
not
None
:
if
value
is
not
None
:
# Always initialize the storage.
# Always initialize the storage.
if
isinstance
(
value
,
link
.
Container
):
if
isinstance
(
value
,
Container
):
# There is no point in obtaining the current value
# There is no point in obtaining the current value
# stored in the container, since the container is
# stored in the container, since the container is
# shared.
# shared.
...
@@ -485,7 +487,7 @@ class Function:
...
@@ -485,7 +487,7 @@ class Function:
"names of the inputs of your function "
"names of the inputs of your function "
"for duplicates."
"for duplicates."
)
)
if
isinstance
(
s
,
link
.
Container
):
if
isinstance
(
s
,
Container
):
return
s
.
value
return
s
.
value
else
:
else
:
raise
NotImplementedError
raise
NotImplementedError
...
@@ -503,7 +505,7 @@ class Function:
...
@@ -503,7 +505,7 @@ class Function:
"names of the inputs of your function "
"names of the inputs of your function "
"for duplicates."
"for duplicates."
)
)
if
isinstance
(
s
,
link
.
Container
):
if
isinstance
(
s
,
Container
):
s
.
value
=
value
s
.
value
=
value
s
.
provided
+=
1
s
.
provided
+=
1
else
:
else
:
...
@@ -812,7 +814,7 @@ class Function:
...
@@ -812,7 +814,7 @@ class Function:
def
restore_defaults
():
def
restore_defaults
():
for
i
,
(
required
,
refeed
,
value
)
in
enumerate
(
self
.
defaults
):
for
i
,
(
required
,
refeed
,
value
)
in
enumerate
(
self
.
defaults
):
if
refeed
:
if
refeed
:
if
isinstance
(
value
,
link
.
Container
):
if
isinstance
(
value
,
Container
):
value
=
value
.
storage
[
0
]
value
=
value
.
storage
[
0
]
self
[
i
]
=
value
self
[
i
]
=
value
...
@@ -978,7 +980,7 @@ class Function:
...
@@ -978,7 +980,7 @@ class Function:
thunk
=
None
thunk
=
None
if
hasattr
(
self
.
fn
,
"thunks"
):
if
hasattr
(
self
.
fn
,
"thunks"
):
thunk
=
self
.
fn
.
thunks
[
self
.
fn
.
position_of_error
]
thunk
=
self
.
fn
.
thunks
[
self
.
fn
.
position_of_error
]
link
.
raise_with_op
(
raise_with_op
(
self
.
maker
.
fgraph
,
self
.
maker
.
fgraph
,
node
=
self
.
fn
.
nodes
[
self
.
fn
.
position_of_error
],
node
=
self
.
fn
.
nodes
[
self
.
fn
.
position_of_error
],
thunk
=
thunk
,
thunk
=
thunk
,
...
@@ -1679,7 +1681,7 @@ class FunctionMaker:
...
@@ -1679,7 +1681,7 @@ class FunctionMaker:
self
.
refeed
=
[
self
.
refeed
=
[
(
(
i
.
value
is
not
None
i
.
value
is
not
None
and
not
isinstance
(
i
.
value
,
link
.
Container
)
and
not
isinstance
(
i
.
value
,
Container
)
and
i
.
update
is
None
and
i
.
update
is
None
)
)
for
i
in
self
.
inputs
for
i
in
self
.
inputs
...
@@ -1772,8 +1774,8 @@ class FunctionMaker:
...
@@ -1772,8 +1774,8 @@ class FunctionMaker:
if
isinstance
(
input_storage_i
,
gof
.
Variable
):
if
isinstance
(
input_storage_i
,
gof
.
Variable
):
input_storage_i
=
input_storage_i
.
container
input_storage_i
=
input_storage_i
.
container
if
isinstance
(
input_storage_i
,
link
.
Container
):
if
isinstance
(
input_storage_i
,
Container
):
# If the default is a
link.
Container, this means we want to
# If the default is a Container, this means we want to
# share the same storage. This is done by appending
# share the same storage. This is done by appending
# input_storage_i.storage to input_storage_lists.
# input_storage_i.storage to input_storage_lists.
if
indices
is
not
None
:
if
indices
is
not
None
:
...
...
theano/compile/io.py
浏览文件 @
27448332
...
@@ -6,7 +6,7 @@ Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out`.
...
@@ -6,7 +6,7 @@ Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out`.
import
logging
import
logging
from
theano
import
link
from
theano
.link.basic
import
Container
_logger
=
logging
.
getLogger
(
"theano.compile.io"
)
_logger
=
logging
.
getLogger
(
"theano.compile.io"
)
...
@@ -208,9 +208,7 @@ class In(SymbolicInput):
...
@@ -208,9 +208,7 @@ class In(SymbolicInput):
if
implicit
is
None
:
if
implicit
is
None
:
from
theano.compile.sharedvalue
import
SharedVariable
from
theano.compile.sharedvalue
import
SharedVariable
implicit
=
isinstance
(
value
,
link
.
Container
)
or
isinstance
(
implicit
=
isinstance
(
value
,
Container
)
or
isinstance
(
value
,
SharedVariable
)
value
,
SharedVariable
)
super
()
.
__init__
(
super
()
.
__init__
(
variable
=
variable
,
variable
=
variable
,
name
=
name
,
name
=
name
,
...
...
theano/compile/sharedvalue.py
浏览文件 @
27448332
...
@@ -11,7 +11,7 @@ import numpy as np
...
@@ -11,7 +11,7 @@ import numpy as np
from
theano.gof.graph
import
Variable
from
theano.gof.graph
import
Variable
from
theano.gof.type
import
generic
from
theano.gof.type
import
generic
from
theano.gof.utils
import
add_tag_trace
from
theano.gof.utils
import
add_tag_trace
from
theano.link
import
Container
from
theano.link
.basic
import
Container
_logger
=
logging
.
getLogger
(
"theano.compile.sharedvalue"
)
_logger
=
logging
.
getLogger
(
"theano.compile.sharedvalue"
)
...
...
theano/link/__init__.py
浏览文件 @
27448332
from
theano.link.basic
import
(
Container
,
\ No newline at end of file
Linker
,
LocalLinker
,
PerformLinker
,
WrapLinker
,
WrapLinkerMany
,
)
from
theano.link.utils
import
gc_helper
,
map_storage
,
raise_with_op
,
streamline
theano/link/c/__init__.py
浏览文件 @
27448332
from
theano.link.c.cc
import
CLinker
,
DualLinker
,
OpWiseCLinker
theano/link/jax/jax_linker.py
浏览文件 @
27448332
...
@@ -3,7 +3,8 @@ from warnings import warn
...
@@ -3,7 +3,8 @@ from warnings import warn
from
theano.gof
import
utils
from
theano.gof
import
utils
from
theano.gof.graph
import
Constant
from
theano.gof.graph
import
Constant
from
theano.link
import
Container
,
PerformLinker
,
gc_helper
,
map_storage
,
streamline
from
theano.link.basic
import
Container
,
PerformLinker
from
theano.link.utils
import
gc_helper
,
map_storage
,
streamline
class
JAXLinker
(
PerformLinker
):
class
JAXLinker
(
PerformLinker
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论