Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
be629ae2
提交
be629ae2
authored
12月 02, 2015
作者:
Martin Arjovsky
提交者:
AdeB
2月 12, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
# This is a combination of 2 commits.
# The first commit's message is: moving flags to configdefaults # The 2nd commit message will be skipped: # moving rest to configdefaults
上级
8a736df5
全部展开
显示空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
0 行增加
和
538 行删除
+0
-538
debugmode.py
theano/compile/debugmode.py
+0
-33
mode.py
theano/compile/mode.py
+0
-16
nanguardmode.py
theano/compile/nanguardmode.py
+0
-21
profilemode.py
theano/compile/profilemode.py
+0
-22
profiling.py
theano/compile/profiling.py
+0
-45
configdefaults.py
theano/configdefaults.py
+0
-0
cc.py
theano/gof/cc.py
+0
-4
cmodule.py
theano/gof/cmodule.py
+0
-30
compiledir.py
theano/gof/compiledir.py
+0
-217
compilelock.py
theano/gof/compilelock.py
+0
-19
opt.py
theano/gof/opt.py
+0
-7
optdb.py
theano/gof/optdb.py
+0
-10
vm.py
theano/gof/vm.py
+0
-33
__init__.py
theano/sandbox/cuda/__init__.py
+0
-30
scan_op.py
theano/scan_module/scan_op.py
+0
-9
sigm.py
theano/tensor/nnet/sigm.py
+0
-8
opt.py
theano/tensor/opt.py
+0
-34
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
be629ae2
...
@@ -33,39 +33,6 @@ from theano.compile.ops import OutputGuard
...
@@ -33,39 +33,6 @@ from theano.compile.ops import OutputGuard
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
AddConfigVar
(
'DebugMode.patience'
,
"Optimize graph this many times to detect inconsistency"
,
IntParam
(
10
,
lambda
i
:
i
>
0
),
in_c_key
=
False
)
AddConfigVar
(
'DebugMode.check_c'
,
"Run C implementations where possible"
,
BoolParam
(
bool
(
theano
.
config
.
cxx
)),
in_c_key
=
False
)
AddConfigVar
(
'DebugMode.check_py'
,
"Run Python implementations where possible"
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'DebugMode.check_finite'
,
"True -> complain about NaN/Inf results"
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'DebugMode.check_strides'
,
(
"Check that Python- and C-produced ndarrays have same strides. "
"On difference: (0) - ignore, (1) warn, or (2) raise error"
),
IntParam
(
0
,
lambda
i
:
i
in
(
0
,
1
,
2
)),
in_c_key
=
False
)
AddConfigVar
(
'DebugMode.warn_input_not_reused'
,
(
"Generate a warning when destroy_map or view_map says that an "
"op works inplace, but the op did not reuse the input for its "
"output."
),
BoolParam
(
True
),
in_c_key
=
False
)
def
is_valid_check_preallocated_output_param
(
param
):
def
is_valid_check_preallocated_output_param
(
param
):
if
not
isinstance
(
param
,
string_types
):
if
not
isinstance
(
param
,
string_types
):
...
...
theano/compile/mode.py
浏览文件 @
be629ae2
...
@@ -17,22 +17,6 @@ from six import string_types
...
@@ -17,22 +17,6 @@ from six import string_types
_logger
=
logging
.
getLogger
(
'theano.compile.mode'
)
_logger
=
logging
.
getLogger
(
'theano.compile.mode'
)
AddConfigVar
(
'optimizer_excluding'
,
(
"When using the default mode, we will remove optimizer with "
"these tags. Separate tags with ':'."
),
StrParam
(
""
,
allow_override
=
False
),
in_c_key
=
False
)
AddConfigVar
(
'optimizer_including'
,
(
"When using the default mode, we will add optimizer with "
"these tags. Separate tags with ':'."
),
StrParam
(
""
,
allow_override
=
False
),
in_c_key
=
False
)
AddConfigVar
(
'optimizer_requiring'
,
(
"When using the default mode, we will require optimizer with "
"these tags. Separate tags with ':'."
),
StrParam
(
""
,
allow_override
=
False
),
in_c_key
=
False
)
def
check_equal
(
x
,
y
):
def
check_equal
(
x
,
y
):
"""
"""
...
...
theano/compile/nanguardmode.py
浏览文件 @
be629ae2
...
@@ -11,27 +11,6 @@ import theano.tensor as T
...
@@ -11,27 +11,6 @@ import theano.tensor as T
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda
as
cuda
from
theano.compile
import
Mode
from
theano.compile
import
Mode
AddConfigVar
(
'NanGuardMode.nan_is_error'
,
"Default value for nan_is_error"
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'NanGuardMode.inf_is_error'
,
"Default value for inf_is_error"
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'NanGuardMode.big_is_error'
,
"Default value for big_is_error"
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'NanGuardMode.action'
,
"What NanGuardMode does when it finds a problem"
,
EnumStr
(
'raise'
,
'warn'
,
'pdb'
),
in_c_key
=
False
)
logger
=
logging
.
getLogger
(
"theano.compile.nanguardmode"
)
logger
=
logging
.
getLogger
(
"theano.compile.nanguardmode"
)
...
...
theano/compile/profilemode.py
浏览文件 @
be629ae2
...
@@ -20,28 +20,6 @@ run_cthunk = None # Will be imported only when needed.
...
@@ -20,28 +20,6 @@ run_cthunk = None # Will be imported only when needed.
import_time
=
time
.
time
()
import_time
=
time
.
time
()
AddConfigVar
(
'ProfileMode.n_apply_to_print'
,
"Number of apply instances to print by default"
,
IntParam
(
15
,
lambda
i
:
i
>
0
),
in_c_key
=
False
)
AddConfigVar
(
'ProfileMode.n_ops_to_print'
,
"Number of ops to print by default"
,
IntParam
(
20
,
lambda
i
:
i
>
0
),
in_c_key
=
False
)
AddConfigVar
(
'ProfileMode.min_memory_size'
,
"For the memory profile, do not print apply nodes if the size "
"of their outputs (in bytes) is lower then this threshold"
,
IntParam
(
1024
,
lambda
i
:
i
>=
0
),
in_c_key
=
False
)
AddConfigVar
(
'ProfileMode.profile_memory'
,
"""Enable profiling of memory used by Theano functions"""
,
BoolParam
(
False
),
in_c_key
=
False
)
class
Profile_Maker
(
FunctionMaker
):
class
Profile_Maker
(
FunctionMaker
):
def
create
(
self
,
input_storage
=
None
,
trustme
=
False
,
storage_map
=
None
):
def
create
(
self
,
input_storage
=
None
,
trustme
=
False
,
storage_map
=
None
):
ret
=
super
(
Profile_Maker
,
self
)
.
create
(
input_storage
,
trustme
,
ret
=
super
(
Profile_Maker
,
self
)
.
create
(
input_storage
,
trustme
,
...
...
theano/compile/profiling.py
浏览文件 @
be629ae2
...
@@ -37,51 +37,6 @@ config = theano.config
...
@@ -37,51 +37,6 @@ config = theano.config
_atexit_print_list
=
[]
_atexit_print_list
=
[]
_atexit_registered
=
False
_atexit_registered
=
False
AddConfigVar
(
'profiling.time_thunks'
,
"""Time individual thunks when profiling"""
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'profiling.n_apply'
,
"Number of Apply instances to print by default"
,
IntParam
(
20
,
lambda
i
:
i
>
0
),
in_c_key
=
False
)
AddConfigVar
(
'profiling.n_ops'
,
"Number of Ops to print by default"
,
IntParam
(
20
,
lambda
i
:
i
>
0
),
in_c_key
=
False
)
AddConfigVar
(
'profiling.output_line_width'
,
"Max line width for the profiling output"
,
IntParam
(
512
,
lambda
i
:
i
>
0
),
in_c_key
=
False
)
AddConfigVar
(
'profiling.min_memory_size'
,
"""For the memory profile, do not print Apply nodes if the size
of their outputs (in bytes) is lower than this threshold"""
,
IntParam
(
1024
,
lambda
i
:
i
>=
0
),
in_c_key
=
False
)
AddConfigVar
(
'profiling.min_peak_memory'
,
"""The min peak memory usage of the order"""
,
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'profiling.destination'
,
"""
File destination of the profiling output
"""
,
StrParam
(
'stderr'
),
in_c_key
=
False
)
AddConfigVar
(
'profiling.debugprint'
,
"""
Do a debugprint of the profiled functions
"""
,
BoolParam
(
False
),
in_c_key
=
False
)
def
_atexit_print_fn
():
def
_atexit_print_fn
():
"""
"""
...
...
theano/configdefaults.py
浏览文件 @
be629ae2
差异被折叠。
点击展开。
theano/gof/cc.py
浏览文件 @
be629ae2
...
@@ -33,10 +33,6 @@ from theano.gof import cmodule
...
@@ -33,10 +33,6 @@ from theano.gof import cmodule
from
theano.gof.compilelock
import
get_lock
,
release_lock
from
theano.gof.compilelock
import
get_lock
,
release_lock
from
theano.gof.callcache
import
CallCache
from
theano.gof.callcache
import
CallCache
AddConfigVar
(
'gcc.cxxflags'
,
"Extra compiler flags for gcc"
,
StrParam
(
""
))
_logger
=
logging
.
getLogger
(
"theano.gof.cc"
)
_logger
=
logging
.
getLogger
(
"theano.gof.cc"
)
...
...
theano/gof/cmodule.py
浏览文件 @
be629ae2
...
@@ -42,36 +42,6 @@ try:
...
@@ -42,36 +42,6 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
AddConfigVar
(
'cmodule.mac_framework_link'
,
"If set to True, breaks certain MacOS installations with the infamous "
"Bus Error"
,
BoolParam
(
False
))
AddConfigVar
(
'cmodule.warn_no_version'
,
"If True, will print a warning when compiling one or more Op "
"with C code that can't be cached because there is no "
"c_code_cache_version() function associated to at least one of "
"those Ops."
,
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'cmodule.remove_gxx_opt'
,
"If True, will remove the -O* parameter passed to g++."
"This is useful to debug in gdb modules compiled by Theano."
"The parameter -g is passed by default to g++"
,
BoolParam
(
False
))
AddConfigVar
(
'cmodule.compilation_warning'
,
"If True, will print compilation warnings."
,
BoolParam
(
False
))
AddConfigVar
(
'cmodule.preload_cache'
,
"If set to True, will preload the C module cache at import time"
,
BoolParam
(
False
,
allow_override
=
False
),
in_c_key
=
False
)
_logger
=
logging
.
getLogger
(
"theano.gof.cmodule"
)
_logger
=
logging
.
getLogger
(
"theano.gof.cmodule"
)
METH_VARARGS
=
"METH_VARARGS"
METH_VARARGS
=
"METH_VARARGS"
...
...
theano/gof/compiledir.py
浏览文件 @
be629ae2
...
@@ -9,7 +9,6 @@ import shutil
...
@@ -9,7 +9,6 @@ import shutil
import
struct
import
struct
import
socket
import
socket
import
sys
import
sys
import
textwrap
import
numpy
import
numpy
...
@@ -56,222 +55,6 @@ def python_int_bitwidth():
...
@@ -56,222 +55,6 @@ def python_int_bitwidth():
return
struct
.
calcsize
(
'l'
)
*
8
return
struct
.
calcsize
(
'l'
)
*
8
compiledir_format_dict
=
{
"platform"
:
platform
.
platform
(),
"processor"
:
platform
.
processor
(),
"python_version"
:
platform
.
python_version
(),
"python_bitwidth"
:
local_bitwidth
(),
"python_int_bitwidth"
:
python_int_bitwidth
(),
"theano_version"
:
theano
.
__version__
,
"numpy_version"
:
numpy
.
__version__
,
"gxx_version"
:
gcc_version_str
.
replace
(
" "
,
"_"
),
"hostname"
:
socket
.
gethostname
()}
def
short_platform
(
r
=
None
,
p
=
None
):
"""
Return a safe shorter version of platform.platform().
The old default Theano compiledir used platform.platform in
it. This use the platform.version() as a substring. This is too
specific as it contain the full kernel number and package
version. This cause the compiledir to change each time there is a
new linux kernel update. This function remove the part of platform
that are too precise.
If we have something else then expected, we do nothing. So this
should be safe on other OS.
Some example if we use platform.platform() direction. On the same
OS, with just some kernel updates.
compiledir_Linux-2.6.32-504.el6.x86_64-x86_64-with-redhat-6.6-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.29.2.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.23.3.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.20.3.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.17.1.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.11.2.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.23.2.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.6.2.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.6.1.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.2.1.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-279.14.1.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-279.14.1.el6.x86_64-x86_64-with-redhat-6.3-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-279.5.2.el6.x86_64-x86_64-with-redhat-6.3-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-220.13.1.el6.x86_64-x86_64-with-redhat-6.3-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-220.13.1.el6.x86_64-x86_64-with-redhat-6.2-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-220.7.1.el6.x86_64-x86_64-with-redhat-6.2-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-220.4.1.el6.x86_64-x86_64-with-redhat-6.2-Santiago-x86_64-2.6.6
We suppose the version are ``X.Y[.*]-(digit)*(anything)*``. We keep ``X.Y``
and don't keep less important digit in the part before ``-`` and we remove
the leading digit after the first ``-``.
If the information don't fit that pattern, we do not modify platform.
"""
if
r
is
None
:
r
=
platform
.
release
()
if
p
is
None
:
p
=
platform
.
platform
()
sp
=
r
.
split
(
'-'
)
if
len
(
sp
)
<
2
:
return
p
# For the split before the first -, we remove all learning digit:
kernel_version
=
sp
[
0
]
.
split
(
'.'
)
if
len
(
kernel_version
)
<=
2
:
# kernel version should always have at least 3 number.
# If not, it use another semantic, so don't change it.
return
p
sp
[
0
]
=
'.'
.
join
(
kernel_version
[:
2
])
# For the split after the first -, we remove leading non-digit value.
rest
=
sp
[
1
]
.
split
(
'.'
)
while
len
(
rest
):
if
rest
[
0
]
.
isdigit
():
del
rest
[
0
]
else
:
break
sp
[
1
]
=
'.'
.
join
(
rest
)
# For sp[2:], we don't change anything.
sr
=
'-'
.
join
(
sp
)
p
=
p
.
replace
(
r
,
sr
)
p
=
p
.
replace
(
':'
,
'-'
)
p
=
p
.
replace
(
'?'
,
'-'
)
p
=
p
.
replace
(
'*'
,
'-'
)
p
=
p
.
replace
(
'/'
,
'-'
)
return
p
compiledir_format_dict
[
'short_platform'
]
=
short_platform
()
compiledir_format_keys
=
", "
.
join
(
sorted
(
compiledir_format_dict
.
keys
()))
default_compiledir_format
=
(
"compiledir_
%(short_platform)
s-
%(processor)
s-"
"
%(python_version)
s-
%(python_bitwidth)
s"
)
AddConfigVar
(
"compiledir_format"
,
textwrap
.
fill
(
textwrap
.
dedent
(
"""
\
Format string for platform-dependent compiled
module subdirectory (relative to base_compiledir).
Available keys:
%
s. Defaults to
%
r.
"""
%
(
compiledir_format_keys
,
default_compiledir_format
))),
StrParam
(
default_compiledir_format
,
allow_override
=
False
),
in_c_key
=
False
)
def
default_compiledirname
():
formatted
=
config
.
compiledir_format
%
compiledir_format_dict
safe
=
re
.
sub
(
"[
\
(
\
)
\
s,]+"
,
"_"
,
formatted
)
return
safe
def
filter_base_compiledir
(
path
):
# Expand '~' in path
return
os
.
path
.
expanduser
(
str
(
path
))
def
filter_compiledir
(
path
):
# Expand '~' in path
path
=
os
.
path
.
expanduser
(
path
)
# Turn path into the 'real' path. This ensures that:
# 1. There is no relative path, which would fail e.g. when trying to
# import modules from the compile dir.
# 2. The path is stable w.r.t. e.g. symlinks (which makes it easier
# to re-use compiled modules).
path
=
os
.
path
.
realpath
(
path
)
if
os
.
access
(
path
,
os
.
F_OK
):
# Do it exist?
if
not
os
.
access
(
path
,
os
.
R_OK
|
os
.
W_OK
|
os
.
X_OK
):
# If it exist we need read, write and listing access
raise
ValueError
(
"compiledir '
%
s' exists but you don't have read, write"
" or listing permissions."
%
path
)
else
:
try
:
os
.
makedirs
(
path
,
0
o770
)
# read-write-execute for user and group
except
OSError
as
e
:
# Maybe another parallel execution of theano was trying to create
# the same directory at the same time.
if
e
.
errno
!=
errno
.
EEXIST
:
raise
ValueError
(
"Unable to create the compiledir directory"
" '
%
s'. Check the permissions."
%
path
)
# PROBLEM: sometimes the initial approach based on
# os.system('touch') returned -1 for an unknown reason; the
# alternate approach here worked in all cases... it was weird.
# No error should happen as we checked the permissions.
init_file
=
os
.
path
.
join
(
path
,
'__init__.py'
)
if
not
os
.
path
.
exists
(
init_file
):
try
:
open
(
init_file
,
'w'
)
.
close
()
except
IOError
as
e
:
if
os
.
path
.
exists
(
init_file
):
pass
# has already been created
else
:
e
.
args
+=
(
'
%
s exist?
%
s'
%
(
path
,
os
.
path
.
exists
(
path
)),)
raise
return
path
def
get_home_dir
():
"""
Return location of the user's home directory.
"""
home
=
os
.
getenv
(
'HOME'
)
if
home
is
None
:
# This expanduser usually works on Windows (see discussion on
# theano-users, July 13 2010).
home
=
os
.
path
.
expanduser
(
'~'
)
if
home
==
'~'
:
# This might happen when expanduser fails. Although the cause of
# failure is a mystery, it has been seen on some Windows system.
home
=
os
.
getenv
(
'USERPROFILE'
)
assert
home
is
not
None
return
home
# On Windows we should avoid writing temporary files to a directory that is
# part of the roaming part of the user profile. Instead we use the local part
# of the user profile, when available.
if
sys
.
platform
==
'win32'
and
os
.
getenv
(
'LOCALAPPDATA'
)
is
not
None
:
default_base_compiledir
=
os
.
path
.
join
(
os
.
getenv
(
'LOCALAPPDATA'
),
'Theano'
)
else
:
home_dir
=
get_home_dir
()
if
not
os
.
access
(
home_dir
,
os
.
W_OK
):
home_dir
=
'/tmp'
user
=
os
.
getenv
(
'USER'
)
if
user
is
not
None
:
home_dir
=
os
.
path
.
join
(
home_dir
,
user
)
default_base_compiledir
=
os
.
path
.
join
(
home_dir
,
'.theano'
)
AddConfigVar
(
'base_compiledir'
,
"platform-independent root directory for compiled modules"
,
ConfigParam
(
default_base_compiledir
,
filter
=
filter_base_compiledir
,
allow_override
=
False
),
in_c_key
=
False
)
AddConfigVar
(
'compiledir'
,
"platform-dependent cache directory for compiled modules"
,
ConfigParam
(
os
.
path
.
join
(
config
.
base_compiledir
,
default_compiledirname
()),
filter
=
filter_compiledir
,
allow_override
=
False
),
in_c_key
=
False
)
def
cleanup
():
def
cleanup
():
"""
"""
Delete keys in old format from the compiledir.
Delete keys in old format from the compiledir.
...
...
theano/gof/compilelock.py
浏览文件 @
be629ae2
...
@@ -22,25 +22,6 @@ if _logger.level == logging.NOTSET:
...
@@ -22,25 +22,6 @@ if _logger.level == logging.NOTSET:
# INFO will show the "Refreshing lock" messages
# INFO will show the "Refreshing lock" messages
_logger
.
setLevel
(
logging
.
INFO
)
_logger
.
setLevel
(
logging
.
INFO
)
AddConfigVar
(
'compile.wait'
,
"""Time to wait before retrying to aquire the compile lock."""
,
IntParam
(
5
,
lambda
i
:
i
>
0
,
allow_override
=
False
),
in_c_key
=
False
)
def
_timeout_default
():
return
config
.
compile
.
wait
*
24
AddConfigVar
(
'compile.timeout'
,
"""In seconds, time that a process will wait before deciding to
override an existing lock. An override only happens when the existing
lock is held by the same owner *and* has not been 'refreshed' by this
owner for more than this period. Refreshes are done every half timeout
period for running processes."""
,
IntParam
(
_timeout_default
,
lambda
i
:
i
>=
0
,
allow_override
=
False
),
in_c_key
=
False
)
hostname
=
socket
.
gethostname
()
hostname
=
socket
.
gethostname
()
...
...
theano/gof/opt.py
浏览文件 @
be629ae2
...
@@ -1042,13 +1042,6 @@ class LocalOptimizer(object):
...
@@ -1042,13 +1042,6 @@ class LocalOptimizer(object):
(
' '
*
level
),
self
.
__class__
.
__name__
,
id
(
self
)),
file
=
stream
)
(
' '
*
level
),
self
.
__class__
.
__name__
,
id
(
self
)),
file
=
stream
)
theano
.
configparser
.
AddConfigVar
(
'metaopt.verbose'
,
"Enable verbose output for meta optimizers"
,
theano
.
configparser
.
BoolParam
(
False
),
in_c_key
=
False
)
class
LocalMetaOptimizer
(
LocalOptimizer
):
class
LocalMetaOptimizer
(
LocalOptimizer
):
"""
"""
Base class for meta-optimizers that try a set of LocalOptimizers
Base class for meta-optimizers that try a set of LocalOptimizers
...
...
theano/gof/optdb.py
浏览文件 @
be629ae2
...
@@ -11,16 +11,6 @@ from theano.gof import opt
...
@@ -11,16 +11,6 @@ from theano.gof import opt
from
theano.configparser
import
AddConfigVar
,
FloatParam
from
theano.configparser
import
AddConfigVar
,
FloatParam
from
theano
import
config
from
theano
import
config
AddConfigVar
(
'optdb.position_cutoff'
,
'Where to stop eariler during optimization. It represent the'
' position of the optimizer where to stop.'
,
FloatParam
(
numpy
.
inf
),
in_c_key
=
False
)
AddConfigVar
(
'optdb.max_use_ratio'
,
'A ratio that prevent infinite loop in EquilibriumOptimizer.'
,
FloatParam
(
5
),
in_c_key
=
False
)
class
DB
(
object
):
class
DB
(
object
):
def
__hash__
(
self
):
def
__hash__
(
self
):
...
...
theano/gof/vm.py
浏览文件 @
be629ae2
...
@@ -23,39 +23,6 @@ from six.moves import xrange
...
@@ -23,39 +23,6 @@ from six.moves import xrange
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
AddConfigVar
(
'profile'
,
"If VM should collect profile information"
,
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'profile_optimizer'
,
"If VM should collect optimizer profile information"
,
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'profile_memory'
,
"If VM should collect memory profile information and print it"
,
BoolParam
(
False
),
in_c_key
=
False
)
def
filter_vm_lazy
(
val
):
if
val
==
'False'
or
val
is
False
:
return
False
elif
val
==
'True'
or
val
is
True
:
return
True
elif
val
==
'None'
or
val
is
None
:
return
None
else
:
raise
ValueError
(
'Valid values for an vm.lazy parameter '
'should be None, False or True, not `
%
s`.'
%
val
)
AddConfigVar
(
'vm.lazy'
,
"Useful only for the vm linkers. When lazy is None,"
" auto detect if lazy evaluation is needed and use the apropriate"
" version. If lazy is True/False, force the version used between"
" Loop/LoopGC and Stack."
,
ConfigParam
(
'None'
,
filter_vm_lazy
),
in_c_key
=
False
)
def
calculate_reallocate_info
(
order
,
fgraph
,
storage_map
,
compute_map_re
,
def
calculate_reallocate_info
(
order
,
fgraph
,
storage_map
,
compute_map_re
,
dependencies
):
dependencies
):
...
...
theano/sandbox/cuda/__init__.py
浏览文件 @
be629ae2
...
@@ -43,36 +43,6 @@ def register_opt(*tags, **kwargs):
...
@@ -43,36 +43,6 @@ def register_opt(*tags, **kwargs):
_logger_name
=
'theano.sandbox.cuda'
_logger_name
=
'theano.sandbox.cuda'
_logger
=
logging
.
getLogger
(
_logger_name
)
_logger
=
logging
.
getLogger
(
_logger_name
)
AddConfigVar
(
'pycuda.init'
,
"""If True, always initialize PyCUDA when Theano want to
initilize the GPU. Currently, we must always initialize
PyCUDA before Theano do it. Setting this flag to True,
ensure that, but always import PyCUDA. It can be done
manually by importing theano.misc.pycuda_init before theano
initialize the GPU device.
"""
,
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'cublas.lib'
,
"""Name of the cuda blas library for the linker."""
,
StrParam
(
'cublas'
))
AddConfigVar
(
'lib.cnmem'
,
"""Do we enable CNMeM or not (a faster CUDA memory allocator).
The parameter represent the start size (in MB or
%
of
total GPU memory) of the memory pool.
0: not enabled.
0 < N <= 1:
%
of the total GPU memory (clipped to .985 for driver memory)
> 0: use that number of MB of memory.
"""
,
# We should not mix both allocator, so we can't override
FloatParam
(
0
,
lambda
i
:
i
>=
0
,
allow_override
=
False
),
in_c_key
=
False
)
# is_nvcc_available called here to initialize global vars in
# is_nvcc_available called here to initialize global vars in
# nvcc_compiler module
# nvcc_compiler module
nvcc_compiler
.
is_nvcc_available
()
nvcc_compiler
.
is_nvcc_available
()
...
...
theano/scan_module/scan_op.py
浏览文件 @
be629ae2
...
@@ -89,15 +89,6 @@ _logger = logging.getLogger('theano.scan_module.scan_op')
...
@@ -89,15 +89,6 @@ _logger = logging.getLogger('theano.scan_module.scan_op')
from
theano.configparser
import
AddConfigVar
,
BoolParam
from
theano.configparser
import
AddConfigVar
,
BoolParam
AddConfigVar
(
'scan.allow_gc'
,
"Allow/disallow gc inside of Scan (default: False)"
,
BoolParam
(
False
))
AddConfigVar
(
'scan.allow_output_prealloc'
,
"Allow/disallow memory preallocation for outputs inside of scan "
"(default: True)"
,
BoolParam
(
True
))
class
Scan
(
PureOp
):
class
Scan
(
PureOp
):
"""
"""
...
...
theano/tensor/nnet/sigm.py
浏览文件 @
be629ae2
...
@@ -462,14 +462,6 @@ def is_1pexp(t):
...
@@ -462,14 +462,6 @@ def is_1pexp(t):
return
None
return
None
AddConfigVar
(
'warn.identify_1pexp_bug'
,
'Warn if Theano versions prior to 7987b51 (2011-12-18) could have '
'yielded a wrong result due to a bug in the is_1pexp function'
,
BoolParam
(
theano
.
configdefaults
.
warn_default
(
'0.4.1'
)),
in_c_key
=
False
)
def
is_exp
(
var
):
def
is_exp
(
var
):
"""
"""
Match a variable with either of the `exp(x)` or `-exp(x)` patterns.
Match a variable with either of the `exp(x)` or `-exp(x)` patterns.
...
...
theano/tensor/opt.py
浏览文件 @
be629ae2
...
@@ -53,12 +53,6 @@ from six import StringIO
...
@@ -53,12 +53,6 @@ from six import StringIO
_logger
=
logging
.
getLogger
(
'theano.tensor.opt'
)
_logger
=
logging
.
getLogger
(
'theano.tensor.opt'
)
theano
.
configparser
.
AddConfigVar
(
'on_shape_error'
,
"warn: print a warning and use the default"
" value. raise: raise an error"
,
theano
.
configparser
.
EnumStr
(
"warn"
,
"raise"
),
in_c_key
=
False
)
# Utilities
# Utilities
...
@@ -230,13 +224,6 @@ def broadcast_like(value, template, fgraph, dtype=None):
...
@@ -230,13 +224,6 @@ def broadcast_like(value, template, fgraph, dtype=None):
return
rval
return
rval
theano
.
configparser
.
AddConfigVar
(
'tensor.insert_inplace_optimizer_validate_nb'
,
"-1: auto, if graph have less then 500 nodes 1, else 10"
,
theano
.
configparser
.
IntParam
(
-
1
),
in_c_key
=
False
)
def
inplace_elemwise_optimizer_op
(
OP
):
def
inplace_elemwise_optimizer_op
(
OP
):
"""
"""
We parametrise it to make it work for Elemwise and GpuElemwise op.
We parametrise it to make it work for Elemwise and GpuElemwise op.
...
@@ -1609,27 +1596,6 @@ local_elemwise_alloc = register_specialize(
...
@@ -1609,27 +1596,6 @@ local_elemwise_alloc = register_specialize(
local_elemwise_alloc_op
(
T
.
Elemwise
,
T
.
Alloc
,
T
.
DimShuffle
)),
local_elemwise_alloc_op
(
T
.
Elemwise
,
T
.
Alloc
,
T
.
DimShuffle
)),
'local_alloc_elemwise'
)
'local_alloc_elemwise'
)
theano
.
configparser
.
AddConfigVar
(
'experimental.local_alloc_elemwise'
,
"DEPRECATED: If True, enable the experimental"
" optimization local_alloc_elemwise."
" Generates error if not True. Use"
" optimizer_excluding=local_alloc_elemwise"
" to dsiable."
,
theano
.
configparser
.
BoolParam
(
True
,
is_valid
=
lambda
x
:
x
),
in_c_key
=
False
)
# False could make the graph faster but not as safe.
theano
.
configparser
.
AddConfigVar
(
'experimental.local_alloc_elemwise_assert'
,
"When the local_alloc_elemwise is applied, add"
" an assert to highlight shape errors."
,
theano
.
configparser
.
BoolParam
(
True
),
in_c_key
=
False
)
@gof.local_optimizer
([
T
.
Elemwise
])
@gof.local_optimizer
([
T
.
Elemwise
])
def
local_fill_sink
(
node
):
def
local_fill_sink
(
node
):
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论