Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0761b0b8
提交
0761b0b8
authored
5月 23, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure we are clean with the versions used on travis.
上级
65d88e32
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
64 行增加
和
60 行删除
+64
-60
debugmode.py
theano/compile/debugmode.py
+12
-12
function.py
theano/compile/function.py
+3
-3
function_module.py
theano/compile/function_module.py
+4
-4
io.py
theano/compile/io.py
+2
-1
mode.py
theano/compile/mode.py
+3
-3
pfunc.py
theano/compile/pfunc.py
+4
-6
profilemode.py
theano/compile/profilemode.py
+2
-1
sharedvalue.py
theano/compile/sharedvalue.py
+1
-2
sched.py
theano/gof/sched.py
+3
-3
test_utils.py
theano/gof/tests/test_utils.py
+6
-3
type.py
theano/gof/type.py
+2
-3
utils.py
theano/gof/utils.py
+3
-1
vm.py
theano/gof/vm.py
+12
-12
test_fftconv.py
theano/sandbox/cuda/tests/test_fftconv.py
+3
-3
_test_mpi_roundtrip.py
theano/tensor/tests/_test_mpi_roundtrip.py
+2
-1
disturb_mem.py
theano/tests/disturb_mem.py
+2
-2
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
0761b0b8
...
@@ -5,13 +5,12 @@
...
@@ -5,13 +5,12 @@
"""
"""
from
__future__
import
print_function
from
__future__
import
print_function
__docformat__
=
"restructuredtext en"
import
copy
import
copy
import
sys
import
sys
import
copy_reg
import
copy_reg
import
gc
import
gc
from
itertools
import
izip
from
itertools
import
izip
import
logging
import
numpy
import
numpy
...
@@ -31,6 +30,8 @@ from theano.compile.function_module import (
...
@@ -31,6 +30,8 @@ from theano.compile.function_module import (
from
theano.compile.mode
import
Mode
,
register_mode
from
theano.compile.mode
import
Mode
,
register_mode
from
theano.compile.ops
import
OutputGuard
from
theano.compile.ops
import
OutputGuard
__docformat__
=
"restructuredtext en"
AddConfigVar
(
'DebugMode.patience'
,
AddConfigVar
(
'DebugMode.patience'
,
"Optimize graph this many times to detect inconsistency"
,
"Optimize graph this many times to detect inconsistency"
,
IntParam
(
10
,
lambda
i
:
i
>
0
),
IntParam
(
10
,
lambda
i
:
i
>
0
),
...
@@ -96,7 +97,6 @@ AddConfigVar('DebugMode.check_preallocated_output_ndim',
...
@@ -96,7 +97,6 @@ AddConfigVar('DebugMode.check_preallocated_output_ndim',
IntParam
(
4
,
lambda
i
:
i
>
0
),
IntParam
(
4
,
lambda
i
:
i
>
0
),
in_c_key
=
False
)
in_c_key
=
False
)
import
logging
_logger
=
logging
.
getLogger
(
"theano.compile.debugmode"
)
_logger
=
logging
.
getLogger
(
"theano.compile.debugmode"
)
...
@@ -303,9 +303,9 @@ class BadOptimization(DebugModeError):
...
@@ -303,9 +303,9 @@ class BadOptimization(DebugModeError):
# N.B. the maximum(..., 1e-8) protects against div by 0 when
# N.B. the maximum(..., 1e-8) protects against div by 0 when
# nv == ov == 0
# nv == ov == 0
reldiff
=
(
abs_diff
reldiff
=
(
abs_diff
/
/
numpy
.
m
aximum
(
numpy
.
absolute
(
nv
)
+
numpy
.
absolute
(
ov
),
numpy
.
ma
aximum
(
numpy
.
absolute
(
nv
)
+
numpy
.
absolute
(
ov
),
1e-8
))
1e-8
))
print
(
" Max Rel Diff: "
,
numpy
.
max
(
reldiff
),
file
=
ssio
)
print
(
" Max Rel Diff: "
,
numpy
.
max
(
reldiff
),
file
=
ssio
)
print
(
" Mean Rel Diff: "
,
numpy
.
mean
(
reldiff
),
file
=
ssio
)
print
(
" Mean Rel Diff: "
,
numpy
.
mean
(
reldiff
),
file
=
ssio
)
print
(
" Median Rel Diff: "
,
numpy
.
median
(
reldiff
),
file
=
ssio
)
print
(
" Median Rel Diff: "
,
numpy
.
median
(
reldiff
),
file
=
ssio
)
...
@@ -730,8 +730,8 @@ def _optcheck_fgraph(input_specs, output_specs, accept_inplace=False):
...
@@ -730,8 +730,8 @@ def _optcheck_fgraph(input_specs, output_specs, accept_inplace=False):
# We need to protect all immutable inputs from inplace operations.
# We need to protect all immutable inputs from inplace operations.
fgraph
.
attach_feature
(
Supervisor
(
fgraph
.
attach_feature
(
Supervisor
(
input
for
spec
,
input
in
zip
(
input_specs
,
fgraph
.
inputs
)
input
for
spec
,
input
in
zip
(
input_specs
,
fgraph
.
inputs
)
if
not
(
spec
.
mutable
or
(
hasattr
(
fgraph
,
'destroyers'
)
if
not
(
spec
.
mutable
or
(
hasattr
(
fgraph
,
'destroyers'
)
and
and
fgraph
.
destroyers
(
input
)))))
fgraph
.
destroyers
(
input
)))))
for
feature
in
std_fgraph
.
features
:
for
feature
in
std_fgraph
.
features
:
fgraph
.
attach_feature
(
feature
())
fgraph
.
attach_feature
(
feature
())
...
@@ -1340,9 +1340,9 @@ def _check_preallocated_output(node, thunk, prealloc_modes, def_val,
...
@@ -1340,9 +1340,9 @@ def _check_preallocated_output(node, thunk, prealloc_modes, def_val,
if
type
(
getattr
(
node
,
'op'
,
None
))
in
ops_with_inner_function
:
if
type
(
getattr
(
node
,
'op'
,
None
))
in
ops_with_inner_function
:
fn_attr_name
=
ops_with_inner_function
[
type
(
node
.
op
)]
fn_attr_name
=
ops_with_inner_function
[
type
(
node
.
op
)]
fn
=
getattr
(
node
.
op
,
fn_attr_name
,
None
)
fn
=
getattr
(
node
.
op
,
fn_attr_name
,
None
)
if
(
not
fn
if
(
not
fn
or
or
not
hasattr
(
fn
,
'maker'
)
not
hasattr
(
fn
,
'maker'
)
or
or
not
hasattr
(
fn
.
maker
,
'mode'
)):
not
hasattr
(
fn
.
maker
,
'mode'
)):
_logger
.
warn
(
'Expected theano function not found in
%
s.
%
s'
,
_logger
.
warn
(
'Expected theano function not found in
%
s.
%
s'
,
node
.
op
,
fn_attr_name
)
node
.
op
,
fn_attr_name
)
else
:
else
:
...
@@ -2251,7 +2251,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
...
@@ -2251,7 +2251,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
inputs
=
[
inputs
]
inputs
=
[
inputs
]
# Wrap them in In or Out instances if needed.
# Wrap them in In or Out instances if needed.
inputs
=
map
(
self
.
wrap_in
,
inputs
)
,
inputs
=
map
(
self
.
wrap_in
,
inputs
)
outputs
=
map
(
self
.
wrap_out
,
outputs
)
outputs
=
map
(
self
.
wrap_out
,
outputs
)
_inputs
=
gof
.
graph
.
inputs
([
o
.
variable
for
o
in
outputs
]
+
_inputs
=
gof
.
graph
.
inputs
([
o
.
variable
for
o
in
outputs
]
+
[
i
.
update
for
i
in
inputs
[
i
.
update
for
i
in
inputs
...
...
theano/compile/function.py
浏览文件 @
0761b0b8
"""Define the `function` function
"""Define the `function` function
"""
"""
__docformat__
=
"restructuredtext en"
import
cPickle
import
cPickle
import
logging
import
logging
_logger
=
logging
.
getLogger
(
'theano.compile.function'
)
import
traceback
as
tb
import
traceback
as
tb
import
re
import
re
...
@@ -16,6 +13,9 @@ from numpy import any
...
@@ -16,6 +13,9 @@ from numpy import any
import
warnings
import
warnings
from
theano
import
compat
from
theano
import
compat
__docformat__
=
"restructuredtext en"
_logger
=
logging
.
getLogger
(
'theano.compile.function'
)
def
function_dump
(
filename
,
inputs
,
outputs
=
None
,
mode
=
None
,
updates
=
None
,
def
function_dump
(
filename
,
inputs
,
outputs
=
None
,
mode
=
None
,
updates
=
None
,
givens
=
None
,
givens
=
None
,
...
...
theano/compile/function_module.py
浏览文件 @
0761b0b8
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
"""
"""
from
__future__
import
print_function
from
__future__
import
print_function
__docformat__
=
"restructuredtext en"
import
copy
import
copy
import
copy_reg
import
copy_reg
import
cPickle
import
cPickle
...
@@ -25,6 +23,8 @@ from theano.gof.op import ops_with_inner_function
...
@@ -25,6 +23,8 @@ from theano.gof.op import ops_with_inner_function
import
logging
import
logging
_logger
=
logging
.
getLogger
(
'theano.compile.function_module'
)
_logger
=
logging
.
getLogger
(
'theano.compile.function_module'
)
__docformat__
=
"restructuredtext en"
class
UnusedInputError
(
Exception
):
class
UnusedInputError
(
Exception
):
"""
"""
...
@@ -1276,8 +1276,8 @@ class FunctionMaker(object):
...
@@ -1276,8 +1276,8 @@ class FunctionMaker(object):
# - variables that have to be provided (used_inputs)
# - variables that have to be provided (used_inputs)
# - shared variables that will be updated
# - shared variables that will be updated
used_inputs
=
gof
.
graph
.
ancestors
(
used_inputs
=
gof
.
graph
.
ancestors
(
([
o
.
variable
for
o
in
outputs
]
([
o
.
variable
for
o
in
outputs
]
+
+
[
i
.
update
for
i
in
inputs
if
getattr
(
i
,
'update'
,
False
)]),
[
i
.
update
for
i
in
inputs
if
getattr
(
i
,
'update'
,
False
)]),
blockers
=
[
i
.
variable
for
i
in
inputs
])
blockers
=
[
i
.
variable
for
i
in
inputs
])
msg
=
(
"theano.function was asked to create a function computing "
msg
=
(
"theano.function was asked to create a function computing "
...
...
theano/compile/io.py
浏览文件 @
0761b0b8
"""Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out` """
"""Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out` """
__docformat__
=
'restructuredtext en'
from
theano
import
gof
from
theano
import
gof
from
sharedvalue
import
SharedVariable
from
sharedvalue
import
SharedVariable
...
@@ -7,6 +6,8 @@ from sharedvalue import SharedVariable
...
@@ -7,6 +6,8 @@ from sharedvalue import SharedVariable
import
logging
import
logging
_logger
=
logging
.
getLogger
(
"theano.compile.io"
)
_logger
=
logging
.
getLogger
(
"theano.compile.io"
)
__docformat__
=
'restructuredtext en'
class
SymbolicInput
(
object
):
class
SymbolicInput
(
object
):
"""
"""
...
...
theano/compile/mode.py
浏览文件 @
0761b0b8
...
@@ -48,9 +48,9 @@ def check_equal(x, y):
...
@@ -48,9 +48,9 @@ def check_equal(x, y):
y
=
y
.
todense
()
y
=
y
.
todense
()
if
isinstance
(
x
,
numpy
.
ndarray
)
and
isinstance
(
y
,
numpy
.
ndarray
):
if
isinstance
(
x
,
numpy
.
ndarray
)
and
isinstance
(
y
,
numpy
.
ndarray
):
if
(
x
.
dtype
!=
y
.
dtype
if
(
x
.
dtype
!=
y
.
dtype
or
or
x
.
shape
!=
y
.
shape
x
.
shape
!=
y
.
shape
or
or
numpy
.
any
(
abs
(
x
-
y
)
>
1e-10
)):
numpy
.
any
(
abs
(
x
-
y
)
>
1e-10
)):
raise
Exception
(
"Output mismatch."
,
raise
Exception
(
"Output mismatch."
,
{
'performlinker'
:
x
,
'clinker'
:
y
})
{
'performlinker'
:
x
,
'clinker'
:
y
})
else
:
else
:
...
...
theano/compile/pfunc.py
浏览文件 @
0761b0b8
"""Provide a simple user friendly API """
"""Provide a simple user friendly API """
__docformat__
=
'restructuredtext en'
from
theano
import
config
from
theano
import
config
from
theano.compile
import
orig_function
,
In
,
Out
from
theano.compile
import
orig_function
,
In
,
Out
from
theano.compile
import
UnusedInputError
from
theano.compile
import
UnusedInputError
...
@@ -13,6 +9,8 @@ from theano.gof import Variable, Constant
...
@@ -13,6 +9,8 @@ from theano.gof import Variable, Constant
import
logging
import
logging
_logger
=
logging
.
getLogger
(
"theano.compile.pfunc"
)
_logger
=
logging
.
getLogger
(
"theano.compile.pfunc"
)
__docformat__
=
'restructuredtext en'
def
rebuild_collect_shared
(
outputs
,
def
rebuild_collect_shared
(
outputs
,
inputs
=
None
,
inputs
=
None
,
...
@@ -232,8 +230,8 @@ def rebuild_collect_shared(outputs,
...
@@ -232,8 +230,8 @@ def rebuild_collect_shared(outputs,
cloned_outputs
.
append
(
Out
(
cloned_v
,
borrow
=
v
.
borrow
))
cloned_outputs
.
append
(
Out
(
cloned_v
,
borrow
=
v
.
borrow
))
else
:
else
:
raise
TypeError
(
'Outputs must be theano Variable or '
raise
TypeError
(
'Outputs must be theano Variable or '
'Out instances. Received '
+
str
(
v
)
'Out instances. Received '
+
str
(
v
)
+
+
' of type '
+
str
(
type
(
v
)))
' of type '
+
str
(
type
(
v
)))
# computed_list.append(cloned_v)
# computed_list.append(cloned_v)
else
:
else
:
if
isinstance
(
outputs
,
Variable
):
if
isinstance
(
outputs
,
Variable
):
...
...
theano/compile/profilemode.py
浏览文件 @
0761b0b8
...
@@ -12,12 +12,13 @@ from theano.compile.mode import (Mode, register_mode,
...
@@ -12,12 +12,13 @@ from theano.compile.mode import (Mode, register_mode,
predefined_optimizers
)
predefined_optimizers
)
from
theano.configparser
import
config
,
AddConfigVar
,
IntParam
,
BoolParam
from
theano.configparser
import
config
,
AddConfigVar
,
IntParam
,
BoolParam
from
theano.compile.function_module
import
FunctionMaker
from
theano.compile.function_module
import
FunctionMaker
run_cthunk
=
None
# Will be imported only when needed.
from
profiling
import
ProfileStats
from
profiling
import
ProfileStats
run_cthunk
=
None
# Will be imported only when needed.
import_time
=
time
.
time
()
import_time
=
time
.
time
()
AddConfigVar
(
'ProfileMode.n_apply_to_print'
,
AddConfigVar
(
'ProfileMode.n_apply_to_print'
,
"Number of apply instances to print by default"
,
"Number of apply instances to print by default"
,
IntParam
(
15
,
lambda
i
:
i
>
0
),
IntParam
(
15
,
lambda
i
:
i
>
0
),
...
...
theano/compile/sharedvalue.py
浏览文件 @
0761b0b8
"""Provide a simple user friendly API to Theano-managed memory"""
"""Provide a simple user friendly API to Theano-managed memory"""
__docformat__
=
'restructuredtext en'
# Standard imports
# Standard imports
import
copy
import
copy
import
logging
import
logging
...
@@ -12,6 +10,7 @@ import numpy
...
@@ -12,6 +10,7 @@ import numpy
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'
class
SharedVariable
(
Variable
):
class
SharedVariable
(
Variable
):
...
...
theano/gof/sched.py
浏览文件 @
0761b0b8
...
@@ -39,9 +39,9 @@ def make_depends():
...
@@ -39,9 +39,9 @@ def make_depends():
def
depends
(
pair
):
def
depends
(
pair
):
""" Returns True if a depends on b """
""" Returns True if a depends on b """
a
,
b
=
pair
a
,
b
=
pair
return
(
any
(
bout
in
a
.
inputs
for
bout
in
b
.
outputs
)
return
(
any
(
bout
in
a
.
inputs
for
bout
in
b
.
outputs
)
or
or
any
(
depends
((
ainp
.
owner
,
b
))
for
ainp
in
a
.
inputs
any
(
depends
((
ainp
.
owner
,
b
))
for
ainp
in
a
.
inputs
if
ainp
.
owner
))
if
ainp
.
owner
))
return
depends
return
depends
...
...
theano/gof/tests/test_utils.py
浏览文件 @
0761b0b8
...
@@ -36,8 +36,11 @@ def test_give_variables_names_small():
...
@@ -36,8 +36,11 @@ def test_give_variables_names_small():
def
test_remove
():
def
test_remove
():
even
=
lambda
x
:
x
%
2
==
0
def
even
(
x
):
odd
=
lambda
x
:
x
%
2
==
1
return
x
%
2
==
0
# The list are neede as with python 3, remove and filter return generators
def
odd
(
x
):
return
x
%
2
==
1
# The list are needed as with python 3, remove and filter return generators
# and we can't compare generators.
# and we can't compare generators.
assert
list
(
remove
(
even
,
range
(
5
)))
==
list
(
filter
(
odd
,
range
(
5
)))
assert
list
(
remove
(
even
,
range
(
5
)))
==
list
(
filter
(
odd
,
range
(
5
)))
theano/gof/type.py
浏览文件 @
0761b0b8
"""WRITEME Defines the `Type` class."""
"""WRITEME Defines the `Type` class."""
__docformat__
=
"restructuredtext en"
from
theano.compat
import
PY3
from
theano.compat
import
PY3
from
theano.gof
import
utils
from
theano.gof
import
utils
...
@@ -13,6 +10,8 @@ from theano.gof import graph
...
@@ -13,6 +10,8 @@ from theano.gof import graph
########
########
from
theano.gof.op
import
CLinkerObject
from
theano.gof.op
import
CLinkerObject
__docformat__
=
"restructuredtext en"
class
CLinkerType
(
CLinkerObject
):
class
CLinkerType
(
CLinkerObject
):
"""Interface specification for Types that can be arguments to a `CLinkerOp`.
"""Interface specification for Types that can be arguments to a `CLinkerOp`.
...
...
theano/gof/utils.py
浏览文件 @
0761b0b8
...
@@ -405,7 +405,9 @@ def give_variables_names(variables):
...
@@ -405,7 +405,9 @@ def give_variables_names(variables):
This function is idempotent."""
This function is idempotent."""
names
=
map
(
lambda
var
:
var
.
name
,
variables
)
names
=
map
(
lambda
var
:
var
.
name
,
variables
)
h
=
hist
(
names
)
h
=
hist
(
names
)
bad_var
=
lambda
var
:
not
var
.
name
or
h
[
var
.
name
]
>
1
def
bad_var
(
var
):
return
not
var
.
name
or
h
[
var
.
name
]
>
1
for
i
,
var
in
enumerate
(
filter
(
bad_var
,
variables
)):
for
i
,
var
in
enumerate
(
filter
(
bad_var
,
variables
)):
var
.
name
=
(
var
.
name
or
""
)
+
"_
%
d"
%
i
var
.
name
=
(
var
.
name
or
""
)
+
"_
%
d"
%
i
...
...
theano/gof/vm.py
浏览文件 @
0761b0b8
...
@@ -93,11 +93,11 @@ def calculate_reallocate_info(order, fgraph, storage_map, compute_map_re,
...
@@ -93,11 +93,11 @@ def calculate_reallocate_info(order, fgraph, storage_map, compute_map_re,
for
ins
in
node
.
inputs
:
for
ins
in
node
.
inputs
:
assert
not
(
ins
in
view_of
and
viewed_by
[
ins
])
assert
not
(
ins
in
view_of
and
viewed_by
[
ins
])
if
(
getattr
(
ins
,
'ndim'
,
None
)
==
0
and
not
storage_map
[
ins
][
0
]
if
(
getattr
(
ins
,
'ndim'
,
None
)
==
0
and
not
storage_map
[
ins
][
0
]
and
and
ins
not
in
fgraph
.
outputs
and
ins
.
owner
ins
not
in
fgraph
.
outputs
and
ins
.
owner
and
a
nd
a
ll
([
compute_map_re
[
v
][
0
]
all
([
compute_map_re
[
v
][
0
]
for
v
in
dependencies
.
get
(
ins
,
[])])
for
v
in
dependencies
.
get
(
ins
,
[])])
and
and
ins
not
in
allocated
):
ins
not
in
allocated
):
# Constant Memory cannot be changed
# Constant Memory cannot be changed
# Constant and shared variables' storage_map value is not empty
# Constant and shared variables' storage_map value is not empty
reuse_out
=
None
reuse_out
=
None
...
@@ -526,9 +526,9 @@ class Stack(VM):
...
@@ -526,9 +526,9 @@ class Stack(VM):
for
i
in
current_apply
.
inputs
:
for
i
in
current_apply
.
inputs
:
# Garbage Collection -> check if anybody else uses
# Garbage Collection -> check if anybody else uses
# this input
# this input
if
(
dependencies
[
i
]
if
(
dependencies
[
i
]
and
and
i
.
owner
i
.
owner
and
and
i
not
in
self
.
outputs
):
i
not
in
self
.
outputs
):
if
all
(
compute_map
[
v
][
0
]
if
all
(
compute_map
[
v
][
0
]
for
v
in
dependencies
[
i
]):
for
v
in
dependencies
[
i
]):
storage_map
[
i
][
0
]
=
None
storage_map
[
i
][
0
]
=
None
...
@@ -1034,10 +1034,10 @@ class VM_Linker(link.LocalLinker):
...
@@ -1034,10 +1034,10 @@ class VM_Linker(link.LocalLinker):
for
node
in
order
:
for
node
in
order
:
clear_after_this_thunk
=
[]
clear_after_this_thunk
=
[]
for
input
in
node
.
inputs
:
for
input
in
node
.
inputs
:
if
(
(
input
in
computed
)
if
(
input
in
computed
and
and
(
input
not
in
fgraph
.
outputs
)
input
not
in
fgraph
.
outputs
and
and
(
node
==
last_user
[
input
])
node
==
last_user
[
input
]
and
and
input
not
in
reallocated_info
.
keys
()):
input
not
in
reallocated_info
.
keys
()):
clear_after_this_thunk
.
append
(
storage_map
[
input
])
clear_after_this_thunk
.
append
(
storage_map
[
input
])
post_thunk_clear
.
append
(
clear_after_this_thunk
)
post_thunk_clear
.
append
(
clear_after_this_thunk
)
else
:
else
:
...
...
theano/sandbox/cuda/tests/test_fftconv.py
浏览文件 @
0761b0b8
...
@@ -7,13 +7,13 @@ from theano.tests import unittest_tools as utt
...
@@ -7,13 +7,13 @@ from theano.tests import unittest_tools as utt
# Skip tests if cuda_ndarray is not available.
# Skip tests if cuda_ndarray is not available.
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
import
theano.sandbox.cuda
as
cuda_ndarray
import
theano.sandbox.cuda
as
cuda_ndarray
if
not
cuda_ndarray
.
cuda_available
:
if
not
cuda_ndarray
.
cuda_available
:
# noqa
raise
SkipTest
(
'Optional package cuda not available'
)
raise
SkipTest
(
'Optional package cuda not available'
)
from
theano.misc.pycuda_init
import
pycuda_available
from
theano.misc.pycuda_init
import
pycuda_available
if
not
pycuda_available
:
if
not
pycuda_available
:
# noqa
raise
SkipTest
(
'Optional package pycuda not available'
)
raise
SkipTest
(
'Optional package pycuda not available'
)
from
theano.sandbox.cuda.fftconv
import
scikits_cuda_available
from
theano.sandbox.cuda.fftconv
import
scikits_cuda_available
if
not
scikits_cuda_available
:
if
not
scikits_cuda_available
:
# noqa
raise
SkipTest
(
'Optional package scikits.cuda not available'
)
raise
SkipTest
(
'Optional package scikits.cuda not available'
)
from
theano.sandbox.cuda
import
float32_shared_constructor
as
shared
from
theano.sandbox.cuda
import
float32_shared_constructor
as
shared
...
...
theano/tensor/tests/_test_mpi_roundtrip.py
浏览文件 @
0761b0b8
...
@@ -2,13 +2,14 @@
...
@@ -2,13 +2,14 @@
# mpiexec -np 2 python _test_mpi_roundtrip.py
# mpiexec -np 2 python _test_mpi_roundtrip.py
from
mpi4py
import
MPI
from
mpi4py
import
MPI
comm
=
MPI
.
COMM_WORLD
import
theano
import
theano
from
theano.tensor.io
import
send
,
recv
,
mpi_cmps
from
theano.tensor.io
import
send
,
recv
,
mpi_cmps
from
theano.gof.sched
import
sort_schedule_fn
from
theano.gof.sched
import
sort_schedule_fn
import
numpy
as
np
import
numpy
as
np
from
sys
import
stdout
,
stderr
,
exit
from
sys
import
stdout
,
stderr
,
exit
comm
=
MPI
.
COMM_WORLD
rank
=
comm
.
Get_rank
()
rank
=
comm
.
Get_rank
()
size
=
comm
.
Get_size
()
size
=
comm
.
Get_size
()
...
...
theano/tests/disturb_mem.py
浏览文件 @
0761b0b8
from
datetime
import
datetime
__authors__
=
"Ian Goodfellow"
__authors__
=
"Ian Goodfellow"
__credits__
=
[
"Ian Goodfellow"
]
__credits__
=
[
"Ian Goodfellow"
]
__license__
=
"3-clause BSD"
__license__
=
"3-clause BSD"
__maintainer__
=
"Ian Goodfellow"
__maintainer__
=
"Ian Goodfellow"
__email__
=
"goodfeli@iro"
__email__
=
"goodfeli@iro"
from
datetime
import
datetime
def
disturb_mem
():
def
disturb_mem
():
# Allocate a time-dependent amount of objects to increase
# Allocate a time-dependent amount of objects to increase
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论