Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6cf6323c
提交
6cf6323c
authored
10月 21, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Apply isort to theano.compile sub-package modules
上级
bfcd85cc
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
74 行增加
和
90 行删除
+74
-90
__init__.py
theano/compile/__init__.py
+20
-29
builders.py
theano/compile/builders.py
+4
-3
debugmode.py
theano/compile/debugmode.py
+9
-13
function.py
theano/compile/function.py
+5
-4
function_module.py
theano/compile/function_module.py
+9
-11
io.py
theano/compile/io.py
+5
-3
mode.py
theano/compile/mode.py
+3
-3
nanguardmode.py
theano/compile/nanguardmode.py
+5
-5
ops.py
theano/compile/ops.py
+4
-8
pfunc.py
theano/compile/pfunc.py
+6
-6
profiling.py
theano/compile/profiling.py
+3
-5
sharedvalue.py
theano/compile/sharedvalue.py
+1
-0
没有找到文件。
theano/compile/__init__.py
浏览文件 @
6cf6323c
from
theano.compile.builders
import
*
from
theano.compile.debugmode
import
DebugMode
from
theano.compile.function
import
function
,
function_dump
from
theano.compile.function_module
import
*
from
theano.compile.io
import
*
from
theano.compile.mode
import
*
from
theano.compile.monitormode
import
MonitorMode
from
theano.compile.ops
import
(
from
theano.compile.ops
import
(
DeepCopyOp
,
DeepCopyOp
,
deep_copy_o
p
,
FromFunctionO
p
,
register_deep_copy_op_c_code
,
Rebroadcast
,
Shape
,
Shape
,
shape
,
register_shape_c_code
,
Shape_i
,
Shape_i
,
register_shape_i_c_cod
e
,
SpecifyShap
e
,
ViewOp
,
ViewOp
,
view_op
,
register_view_op_c_code
,
FromFunctionOp
,
as_op
,
as_op
,
Rebroadcast
,
deep_copy_op
,
register_deep_copy_op_c_code
,
register_rebroadcast_c_code
,
register_rebroadcast_c_code
,
SpecifyShap
e
,
register_shape_c_cod
e
,
specify_shap
e
,
register_shape_i_c_cod
e
,
register_specify_shape_c_code
,
register_specify_shape_c_code
,
register_view_op_c_code
,
shape
,
specify_shape
,
view_op
,
)
)
from
theano.compile.pfunc
import
Param
,
pfunc
,
rebuild_collect_shared
from
theano.compile.function_module
import
*
from
theano.compile.mode
import
*
from
theano.compile.io
import
*
from
theano.compile.debugmode
import
DebugMode
from
theano.compile.monitormode
import
MonitorMode
from
theano.compile.profiling
import
ProfileStats
,
ScanProfileStats
from
theano.compile.profiling
import
ProfileStats
,
ScanProfileStats
from
theano.compile.sharedvalue
import
SharedVariable
,
shared
,
shared_constructor
from
theano.compile.sharedvalue
import
shared
,
shared_constructor
,
SharedVariable
from
theano.compile.pfunc
import
pfunc
,
Param
,
rebuild_collect_shared
from
theano.compile.builders
import
*
from
theano.compile.function
import
function
,
function_dump
theano/compile/builders.py
浏览文件 @
6cf6323c
"""Define new Ops from existing Ops"""
"""Define new Ops from existing Ops"""
from
functools
import
reduce
,
partial
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
functools
import
partial
,
reduce
import
theano
import
theano
from
theano
import
gof
from
theano
import
gof
from
theano.compile.function_module
import
orig_function
from
theano.compile.function_module
import
orig_function
from
theano.compile
import
SharedVariable
,
rebuild_collect_shared
,
optdb
from
theano.compile.mode
import
optdb
from
theano.compile.pfunc
import
rebuild_collect_shared
from
theano.compile.sharedvalue
import
SharedVariable
from
theano.gof
import
Variable
,
ops_with_inner_function
from
theano.gof
import
Variable
,
ops_with_inner_function
from
theano.gof.graph
import
io_connection_pattern
from
theano.gof.graph
import
io_connection_pattern
from
theano.gof.null_type
import
NullType
from
theano.gof.null_type
import
NullType
...
...
theano/compile/debugmode.py
浏览文件 @
6cf6323c
...
@@ -7,32 +7,28 @@ TODO: add support for IfElse Op, LazyLinker, PureOp, etc.
...
@@ -7,32 +7,28 @@ TODO: add support for IfElse Op, LazyLinker, PureOp, etc.
import
copy
import
copy
import
sys
import
gc
import
gc
import
logging
import
logging
import
sys
from
itertools
import
chain
from
itertools
import
product
as
itertools_product
import
numpy
as
np
import
numpy
as
np
import
theano
from
itertools
import
chain
,
product
as
itertools_product
from
six.moves
import
StringIO
from
six.moves
import
StringIO
from
theano
import
gof
,
config
import
theano
from
theano
import
change_flags
,
config
,
gof
from
theano.compat
import
get_unbound_function
from
theano.compat
import
get_unbound_function
from
theano.gof
import
graph
,
utils
,
link
,
ops_with_inner_function
from
theano.gof.link
import
raise_with_op
from
theano.compile.function_module
import
(
from
theano.compile.function_module
import
(
FunctionMaker
,
Function
,
Function
,
FunctionMaker
,
infer_reuse_pattern
,
infer_reuse_pattern
,
std_fgraph
,
std_fgraph
,
)
)
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
import
change_flags
from
theano.gof
import
graph
,
link
,
ops_with_inner_function
,
utils
from
theano.gof.link
import
raise_with_op
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
...
@@ -1197,8 +1193,8 @@ def _get_preallocated_maps(
...
@@ -1197,8 +1193,8 @@ def _get_preallocated_maps(
"""
"""
# To avoid circular imports
# To avoid circular imports
from
theano.tensor
import
TensorType
from
theano.gpuarray
import
GpuArrayType
from
theano.gpuarray
import
GpuArrayType
from
theano.tensor
import
TensorType
try
:
try
:
import
pygpu
import
pygpu
...
...
theano/compile/function.py
浏览文件 @
6cf6323c
...
@@ -5,15 +5,16 @@ Define the `function` function.
...
@@ -5,15 +5,16 @@ Define the `function` function.
import
logging
import
logging
import
traceback
as
tb
import
re
import
re
import
traceback
as
tb
import
warnings
from
six
import
string_types
from
six
import
string_types
from
theano
import
compat
from
theano.compile.function_module
import
orig_function
from
theano.compile.function_module
import
orig_function
from
theano.compile.pfunc
import
pfunc
from
theano.compile.pfunc
import
pfunc
import
warnings
from
theano
import
compat
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
_logger
=
logging
.
getLogger
(
"theano.compile.function"
)
_logger
=
logging
.
getLogger
(
"theano.compile.function"
)
...
...
theano/compile/function_module.py
浏览文件 @
6cf6323c
...
@@ -4,28 +4,25 @@ Driver of graph construction, optimization, and linking.
...
@@ -4,28 +4,25 @@ Driver of graph construction, optimization, and linking.
"""
"""
import
copy
import
copy
import
time
import
logging
import
logging
import
time
import
warnings
import
warnings
from
itertools
import
chain
import
numpy
as
np
import
six.moves.copyreg
as
copyreg
import
six.moves.copyreg
as
copyreg
import
six.moves.cPickle
as
pickle
import
six.moves.cPickle
as
pickle
from
six
import
string_types
import
numpy
as
np
import
theano
import
theano
import
theano.compile.profiling
import
theano.compile.profiling
from
itertools
import
chain
from
six
import
string_types
from
theano
import
config
,
gof
from
theano
import
config
,
gof
from
theano.gof
import
graph
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
.toolbox
import
is_same_
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
_logger
=
logging
.
getLogger
(
"theano.compile.function_module"
)
_logger
=
logging
.
getLogger
(
"theano.compile.function_module"
)
...
@@ -1369,9 +1366,10 @@ class FunctionMaker(object):
...
@@ -1369,9 +1366,10 @@ class FunctionMaker(object):
def
optimize_graph_with_cache
(
self
,
optimizer
,
inputs
,
outputs
):
def
optimize_graph_with_cache
(
self
,
optimizer
,
inputs
,
outputs
):
# This function is not finished
# This function is not finished
from
theano.gof.compilelock
import
get_lock
,
release_lock
import
os.path
import
os.path
from
theano.gof.compilelock
import
get_lock
,
release_lock
graph_db_file
=
os
.
path
.
join
(
theano
.
config
.
compiledir
,
"optimized_graphs.pkl"
)
graph_db_file
=
os
.
path
.
join
(
theano
.
config
.
compiledir
,
"optimized_graphs.pkl"
)
# the inputs, outputs, and size of the graph to be optimized
# the inputs, outputs, and size of the graph to be optimized
...
...
theano/compile/io.py
浏览文件 @
6cf6323c
...
@@ -4,12 +4,14 @@ Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out`.
...
@@ -4,12 +4,14 @@ Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out`.
"""
"""
from
theano
import
gof
import
logging
from
.sharedvalue
import
SharedVariable
from
six
import
string_types
from
six
import
string_types
import
logging
from
theano
import
gof
from
.sharedvalue
import
SharedVariable
_logger
=
logging
.
getLogger
(
"theano.compile.io"
)
_logger
=
logging
.
getLogger
(
"theano.compile.io"
)
...
...
theano/compile/mode.py
浏览文件 @
6cf6323c
...
@@ -6,15 +6,15 @@ WRITEME
...
@@ -6,15 +6,15 @@ WRITEME
import
logging
import
logging
import
warnings
import
warnings
import
theano
import
theano.gof.vm
from
six
import
string_types
from
six
import
string_types
import
theano
import
theano.gof.vm
from
theano
import
config
,
gof
from
theano
import
config
,
gof
from
theano.compile.function_module
import
Supervisor
from
theano.compile.function_module
import
Supervisor
from
theano.sandbox.jax_linker
import
JAXLinker
from
theano.sandbox.jax_linker
import
JAXLinker
_logger
=
logging
.
getLogger
(
"theano.compile.mode"
)
_logger
=
logging
.
getLogger
(
"theano.compile.mode"
)
...
...
theano/compile/nanguardmode.py
浏览文件 @
6cf6323c
import
logging
import
logging
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
StringIO
import
theano
import
theano
import
theano.tensor
as
tt
import
theano.tensor
as
tt
from
six.moves
import
StringIO
from
theano
import
config
from
theano
import
config
from
theano.compat
import
ValuesView
from
theano.compat
import
ValuesView
from
theano.compile.mode
import
get_mode
,
Mode
from
theano.compile.mode
import
Mode
,
get_mode
try
:
try
:
from
theano.gpuarray.type
import
GpuArrayType
,
_name_for_ctx
from
pygpu.gpuarray
import
GpuArray
from
pygpu.gpuarray
import
GpuArray
from
theano.gpuarray.type
import
GpuArrayType
,
_name_for_ctx
pygpu_available
=
True
pygpu_available
=
True
except
ImportError
:
except
ImportError
:
pygpu_available
=
False
pygpu_available
=
False
...
...
theano/compile/ops.py
浏览文件 @
6cf6323c
...
@@ -7,18 +7,14 @@ help make new Ops more rapidly.
...
@@ -7,18 +7,14 @@ help make new Ops more rapidly.
import
copy
import
copy
import
warnings
import
warnings
import
six.moves.cPickle
as
pickle
import
numpy
as
np
import
theano
from
collections
import
OrderedDict
from
collections
import
OrderedDict
import
numpy
as
np
import
six.moves.cPickle
as
pickle
from
six
import
integer_types
from
six
import
integer_types
from
theano.gof
import
Op
,
Apply
,
ParamsType
,
Variable
import
theano
from
theano.gof
import
Apply
,
Op
,
ParamsType
,
Variable
def
register_view_op_c_code
(
type
,
code
,
version
=
()):
def
register_view_op_c_code
(
type
,
code
,
version
=
()):
...
...
theano/compile/pfunc.py
浏览文件 @
6cf6323c
...
@@ -3,16 +3,16 @@ Provide a simple user friendly API.
...
@@ -3,16 +3,16 @@ Provide a simple user friendly API.
"""
"""
import
warnings
import
logging
import
logging
import
warnings
from
theano
import
config
from
theano
import
config
from
theano.compile.function_module
import
UnusedInputError
,
orig_function
from
theano.compile
import
orig_function
,
In
,
Out
from
theano.compile.io
import
In
,
Out
from
theano.compile
import
UnusedInputError
from
theano.compile.sharedvalue
import
SharedVariable
,
shared
from
theano.compile.profiling
import
ProfileStats
from
theano.compile.profiling
import
ProfileStats
from
theano.gof
import
Variable
,
Constant
from
theano.compile.sharedvalue
import
SharedVariable
,
shared
from
theano.gof
import
Constant
,
Variable
_logger
=
logging
.
getLogger
(
"theano.compile.pfunc"
)
_logger
=
logging
.
getLogger
(
"theano.compile.pfunc"
)
...
...
theano/compile/profiling.py
浏览文件 @
6cf6323c
...
@@ -16,13 +16,11 @@ import os
...
@@ -16,13 +16,11 @@ import os
import
sys
import
sys
import
time
import
time
import
warnings
import
warnings
from
collections
import
defaultdict
import
numpy
as
np
import
numpy
as
np
import
theano
import
theano
from
collections
import
defaultdict
from
theano.gof
import
graph
from
theano.gof
import
graph
...
@@ -1701,9 +1699,9 @@ class ProfileStats(object):
...
@@ -1701,9 +1699,9 @@ class ProfileStats(object):
printed_tip
=
True
printed_tip
=
True
# tip 7
# tip 7
from
theano.tensor.nnet
import
LogSoftmax
import
theano.tensor.signal.pool
as
pool
import
theano.gpuarray
import
theano.gpuarray
import
theano.tensor.signal.pool
as
pool
from
theano.tensor.nnet
import
LogSoftmax
for
a
in
self
.
apply_time
:
for
a
in
self
.
apply_time
:
node
=
a
node
=
a
...
...
theano/compile/sharedvalue.py
浏览文件 @
6cf6323c
...
@@ -14,6 +14,7 @@ import numpy as np
...
@@ -14,6 +14,7 @@ import numpy as np
# Theano imports
# Theano imports
from
theano.gof
import
Container
,
Variable
,
generic
,
utils
from
theano.gof
import
Container
,
Variable
,
generic
,
utils
_logger
=
logging
.
getLogger
(
"theano.compile.sharedvalue"
)
_logger
=
logging
.
getLogger
(
"theano.compile.sharedvalue"
)
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论