Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
bfcd85cc
提交
bfcd85cc
authored
10月 21, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Apply isort to theano top-level modules
上级
5b6f20c0
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
81 行增加
和
98 行删除
+81
-98
__init__.py
theano/__init__.py
+36
-40
breakpoint.py
theano/breakpoint.py
+1
-2
compat.py
theano/compat.py
+12
-17
configdefaults.py
theano/configdefaults.py
+7
-6
configparser.py
theano/configparser.py
+3
-3
gradient.py
theano/gradient.py
+10
-10
ifelse.py
theano/ifelse.py
+3
-7
printing.py
theano/printing.py
+8
-12
raise_op.py
theano/raise_op.py
+1
-0
updates.py
theano/updates.py
+0
-1
没有找到文件。
theano/__init__.py
浏览文件 @
bfcd85cc
...
@@ -54,6 +54,7 @@ def disable_log_handler(logger=theano_logger, handler=logging_default_handler):
...
@@ -54,6 +54,7 @@ def disable_log_handler(logger=theano_logger, handler=logging_default_handler):
# Version information.
# Version information.
from
theano.version
import
version
as
__version__
from
theano.version
import
version
as
__version__
# Raise a meaningful warning/error if the theano directory is in the Python
# Raise a meaningful warning/error if the theano directory is in the Python
# path.
# path.
rpath
=
os
.
path
.
realpath
(
__path__
[
0
])
rpath
=
os
.
path
.
realpath
(
__path__
[
0
])
...
@@ -65,6 +66,7 @@ for p in sys.path:
...
@@ -65,6 +66,7 @@ for p in sys.path:
from
theano.configdefaults
import
config
from
theano.configdefaults
import
config
from
theano.configparser
import
change_flags
from
theano.configparser
import
change_flags
# This is the api version for ops that generate C code. External ops
# This is the api version for ops that generate C code. External ops
# might need manual changes if this number goes up. An undefined
# might need manual changes if this number goes up. An undefined
# __api_version__ can be understood to mean api version 0.
# __api_version__ can be understood to mean api version 0.
...
@@ -73,59 +75,53 @@ from theano.configparser import change_flags
...
@@ -73,59 +75,53 @@ from theano.configparser import change_flags
# very rarely.
# very rarely.
__api_version__
=
1
__api_version__
=
1
from
theano
import
scalar
,
tensor
from
theano.compile
import
(
FunctionMaker
,
In
,
Mode
,
OpFromGraph
,
Out
,
Param
,
ProfileStats
,
SymbolicInput
,
SymbolicOutput
,
as_op
,
function
,
function_dump
,
predefined_linkers
,
predefined_modes
,
predefined_optimizers
,
shared
,
)
from
theano.gof
import
(
from
theano.gof
import
(
Apply
,
CLinker
,
CLinker
,
OpWiseCLinker
,
Constant
,
Container
,
DualLinker
,
DualLinker
,
FunctionGraph
,
Generic
,
InconsistencyError
,
Linker
,
Linker
,
LocalLinker
,
LocalLinker
,
PerformLinker
,
Container
,
InconsistencyError
,
FunctionGraph
,
Apply
,
Variable
,
Constant
,
Op
,
Op
,
OpenMPOp
,
OpenMPOp
,
opt
,
OpWiseCLinker
,
toolbox
,
PerformLinker
,
Type
,
Type
,
Generic
,
Variable
,
generic
,
generic
,
object2
,
object2
,
opt
,
toolbox
,
utils
,
utils
,
)
)
from
theano.gradient
import
Lop
,
Rop
,
grad
,
subgraph_grad
from
theano.compile
import
(
SymbolicInput
,
In
,
SymbolicOutput
,
Out
,
Mode
,
predefined_modes
,
predefined_linkers
,
predefined_optimizers
,
FunctionMaker
,
function
,
function_dump
,
OpFromGraph
,
ProfileStats
,
Param
,
shared
,
as_op
,
)
from
theano.misc.safe_asarray
import
_asarray
from
theano.misc.safe_asarray
import
_asarray
from
theano.printing
import
pp
,
pprint
from
theano.printing
import
pprint
,
pp
from
theano
import
tensor
from
theano
import
scalar
from
theano.updates
import
OrderedUpdates
from
theano.updates
import
OrderedUpdates
from
theano.gradient
import
Rop
,
Lop
,
grad
,
subgraph_grad
if
(
if
(
config
.
device
.
startswith
(
"cuda"
)
config
.
device
.
startswith
(
"cuda"
)
...
@@ -139,6 +135,7 @@ if (
...
@@ -139,6 +135,7 @@ if (
# Use config.numpy to call numpy.seterr
# Use config.numpy to call numpy.seterr
import
numpy
as
np
import
numpy
as
np
if
config
.
numpy
.
seterr_all
==
"None"
:
if
config
.
numpy
.
seterr_all
==
"None"
:
_all
=
None
_all
=
None
else
:
else
:
...
@@ -219,5 +216,4 @@ def sparse_grad(var):
...
@@ -219,5 +216,4 @@ def sparse_grad(var):
import
theano.tensor.shared_randomstreams
import
theano.tensor.shared_randomstreams
from
theano.scan_module
import
clone
,
foldl
,
foldr
,
map
,
reduce
,
scan
,
scan_checkpoints
from
theano.scan_module
import
scan
,
map
,
reduce
,
foldl
,
foldr
,
clone
,
scan_checkpoints
theano/breakpoint.py
浏览文件 @
bfcd85cc
...
@@ -2,8 +2,7 @@ import numpy as np
...
@@ -2,8 +2,7 @@ import numpy as np
import
theano
import
theano
import
theano.tensor
as
tt
import
theano.tensor
as
tt
from
theano.gof
import
Apply
,
Op
from
theano.gof
import
Op
,
Apply
from
theano.gradient
import
DisconnectedType
from
theano.gradient
import
DisconnectedType
...
...
theano/compat.py
浏览文件 @
bfcd85cc
...
@@ -2,31 +2,25 @@
...
@@ -2,31 +2,25 @@
"""
"""
from
collections
import
OrderedDict
# Python 3.x compatibility
# Python 3.x compatibility
from
six
import
PY3
,
b
,
BytesIO
,
next
from
six
import
PY3
,
BytesIO
,
b
,
next
from
six.moves
import
configparser
from
six.moves
import
configparser
from
six.moves
import
reload_module
as
reload
from
six.moves
import
reload_module
as
reload
from
collections
import
OrderedDict
try
:
try
:
from
collections.abc
import
(
from
collections.abc
import
Callable
,
Iterable
,
Mapping
Callable
,
from
collections.abc
import
MutableMapping
as
DictMixin
Iterable
,
from
collections.abc
import
ValuesView
Mapping
,
ValuesView
,
MutableMapping
as
DictMixin
,
)
except
ImportError
:
except
ImportError
:
# this raises an DeprecationWarning on py37 and will become
# this raises an DeprecationWarning on py37 and will become
# and Exception in py39. Importing from collections.abc
# and Exception in py39. Importing from collections.abc
# won't work on py27
# won't work on py27
from
collections
import
(
from
collections
import
Callable
,
Iterable
,
Mapping
Callable
,
from
collections
import
MutableMapping
as
DictMixin
Iterable
,
from
collections
import
ValuesView
Mapping
,
ValuesView
,
MutableMapping
as
DictMixin
,
)
__all__
=
[
"PY3"
,
"b"
,
"BytesIO"
,
"next"
,
"configparser"
,
"reload"
]
__all__
=
[
"PY3"
,
"b"
,
"BytesIO"
,
"next"
,
"configparser"
,
"reload"
]
...
@@ -66,9 +60,10 @@ if PY3:
...
@@ -66,9 +60,10 @@ if PY3:
else
:
else
:
from
six
import
get_unbound_function
from
operator
import
div
as
operator_div
from
operator
import
div
as
operator_div
from
six
import
get_unbound_function
def
exc_message
(
e
):
def
exc_message
(
e
):
return
e
[
0
]
return
e
[
0
]
...
...
theano/configdefaults.py
浏览文件 @
bfcd85cc
import
errno
import
errno
import
os
import
sys
import
logging
import
logging
import
numpy
as
np
import
os
import
platform
import
platform
import
textwrap
import
re
import
re
import
socket
import
socket
import
struct
import
struct
import
sys
import
textwrap
import
warnings
import
warnings
import
numpy
as
np
from
six
import
string_types
from
six
import
string_types
import
theano
import
theano
from
theano.compat
import
maybe_add_to_os_environ_pathlist
from
theano.configparser
import
(
from
theano.configparser
import
(
THEANO_FLAGS_DICT
,
AddConfigVar
,
AddConfigVar
,
BoolParam
,
BoolParam
,
ConfigParam
,
ConfigParam
,
...
@@ -22,11 +24,9 @@ from theano.configparser import (
...
@@ -22,11 +24,9 @@ from theano.configparser import (
IntParam
,
IntParam
,
StrParam
,
StrParam
,
TheanoConfigParser
,
TheanoConfigParser
,
THEANO_FLAGS_DICT
,
)
)
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.windows
import
call_subprocess_Popen
,
output_subprocess_Popen
from
theano.misc.windows
import
call_subprocess_Popen
,
output_subprocess_Popen
from
theano.compat
import
maybe_add_to_os_environ_pathlist
_logger
=
logging
.
getLogger
(
"theano.configdefaults"
)
_logger
=
logging
.
getLogger
(
"theano.configdefaults"
)
...
@@ -1668,6 +1668,7 @@ def default_blas_ldflags():
...
@@ -1668,6 +1668,7 @@ def default_blas_ldflags():
# ignored"
# ignored"
# This happen with Python 2.7.3 |EPD 7.3-1 and numpy 1.8.1
# This happen with Python 2.7.3 |EPD 7.3-1 and numpy 1.8.1
# isort: off
import
numpy.distutils.system_info
# noqa
import
numpy.distutils.system_info
# noqa
# We need to catch warnings as in some cases NumPy print
# We need to catch warnings as in some cases NumPy print
...
...
theano/configparser.py
浏览文件 @
bfcd85cc
...
@@ -8,14 +8,14 @@ import os
...
@@ -8,14 +8,14 @@ import os
import
shlex
import
shlex
import
sys
import
sys
import
warnings
import
warnings
import
theano
from
functools
import
wraps
from
functools
import
wraps
from
six
import
StringIO
,
PY3
,
string_types
from
six
import
PY3
,
StringIO
,
string_types
import
theano
from
theano.compat
import
configparser
as
ConfigParser
from
theano.compat
import
configparser
as
ConfigParser
_logger
=
logging
.
getLogger
(
"theano.configparser"
)
_logger
=
logging
.
getLogger
(
"theano.configparser"
)
...
...
theano/gradient.py
浏览文件 @
bfcd85cc
...
@@ -3,20 +3,20 @@
...
@@ -3,20 +3,20 @@
import
logging
import
logging
import
time
import
time
import
warnings
import
warnings
from
collections
import
OrderedDict
from
functools
import
reduce
import
numpy
as
np
# for numeric_grad
import
numpy
as
np
import
theano
import
theano
from
functools
import
reduce
from
collections
import
OrderedDict
from
theano
import
gof
from
theano
import
gof
from
theano.gof
import
utils
,
Variable
from
theano.compile.debugmode
import
DebugMode
from
theano.compile.mode
import
FAST_RUN
,
get_mode
from
theano.compile.ops
import
ViewOp
from
theano.gof
import
Variable
,
utils
from
theano.gof.null_type
import
NullType
,
null_type
from
theano.gof.null_type
import
NullType
,
null_type
from
theano.gof.op
import
get_test_values
from
theano.gof.op
import
get_test_values
from
theano.compile
import
ViewOp
,
FAST_RUN
,
DebugMode
,
get_mode
__authors__
=
"James Bergstra, Razvan Pascanu, Arnaud Bergeron, Ian Goodfellow"
__authors__
=
"James Bergstra, Razvan Pascanu, Arnaud Bergeron, Ian Goodfellow"
__copyright__
=
"(c) 2011, Universite de Montreal"
__copyright__
=
"(c) 2011, Universite de Montreal"
...
@@ -1790,9 +1790,9 @@ def verify_grad(
...
@@ -1790,9 +1790,9 @@ def verify_grad(
"""
"""
# The import is here to prevent circular import.
# The import is here to prevent circular import.
from
theano
import
compile
,
shared
import
theano.tensor
import
theano.tensor
from
theano.tensor
import
as_tensor_variable
,
TensorType
from
theano
import
compile
,
shared
from
theano.tensor
import
TensorType
,
as_tensor_variable
assert
isinstance
(
pt
,
(
list
,
tuple
))
assert
isinstance
(
pt
,
(
list
,
tuple
))
pt
=
[
np
.
array
(
p
)
for
p
in
pt
]
pt
=
[
np
.
array
(
p
)
for
p
in
pt
]
...
...
theano/ifelse.py
浏览文件 @
bfcd85cc
...
@@ -12,20 +12,16 @@ is a global operation with a scalar condition.
...
@@ -12,20 +12,16 @@ is a global operation with a scalar condition.
"""
"""
import
logging
import
logging
from
copy
import
deepcopy
import
numpy
as
np
import
numpy
as
np
import
theano.tensor
import
theano.tensor
from
copy
import
deepcopy
from
theano.tensor
import
TensorType
from
theano
import
gof
from
theano
import
gof
from
theano.gof
import
Op
,
Apply
from
theano.compile
import
optdb
from
theano.compile
import
optdb
from
theano.
tensor
import
opt
from
theano.
gof
import
Apply
,
Op
from
theano.scan_module.scan_utils
import
clone
from
theano.scan_module.scan_utils
import
clone
from
theano.tensor
import
TensorType
,
opt
__docformat__
=
"restructedtext en"
__docformat__
=
"restructedtext en"
...
...
theano/printing.py
浏览文件 @
bfcd85cc
...
@@ -4,26 +4,22 @@ They all allow different way to print a graph or the result of an Op
...
@@ -4,26 +4,22 @@ They all allow different way to print a graph or the result of an Op
in a graph(Print Op)
in a graph(Print Op)
"""
"""
import
hashlib
import
logging
import
logging
import
os
import
os
import
sys
import
sys
import
hashlib
from
copy
import
copy
from
functools
import
reduce
import
numpy
as
np
import
numpy
as
np
from
six
import
integer_types
,
string_types
from
six.moves
import
StringIO
import
theano
import
theano
from
theano
import
config
,
gof
from
theano.compile
import
Function
,
SharedVariable
,
debugmode
from
theano.gof
import
Apply
,
Op
from
functools
import
reduce
from
copy
import
copy
from
six
import
string_types
,
integer_types
from
six.moves
import
StringIO
from
theano
import
gof
from
theano
import
config
from
theano.gof
import
Op
,
Apply
from
theano.compile
import
Function
,
debugmode
,
SharedVariable
pydot_imported
=
False
pydot_imported
=
False
pydot_imported_msg
=
""
pydot_imported_msg
=
""
...
...
theano/raise_op.py
浏览文件 @
bfcd85cc
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
from
theano
import
gof
from
theano
import
gof
__authors__
=
"James Bergstra"
__authors__
=
"James Bergstra"
__copyright__
=
"(c) 2011, Universite de Montreal"
__copyright__
=
"(c) 2011, Universite de Montreal"
__license__
=
"3-clause BSD License"
__license__
=
"3-clause BSD License"
...
...
theano/updates.py
浏览文件 @
bfcd85cc
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
"""
"""
import
logging
import
logging
import
warnings
import
warnings
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
theano.compile.sharedvalue
import
SharedVariable
from
theano.compile.sharedvalue
import
SharedVariable
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论