Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
167df2c4
提交
167df2c4
authored
1月 06, 2016
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3801 from nouiz/doc
Doc clarification and skip flake8 tests on auto saved file
上级
cb795385
6d735359
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
34 行增加
和
32 行删除
+34
-32
test_pycuda_example.py
theano/misc/tests/test_pycuda_example.py
+0
-1
opt.py
theano/sandbox/cuda/opt.py
+8
-8
test_abstractconv.py
theano/sandbox/cuda/tests/test_abstractconv.py
+7
-5
test_basic_ops.py
theano/sandbox/cuda/tests/test_basic_ops.py
+0
-2
scan_perform_ext.py
theano/scan_module/scan_perform_ext.py
+0
-1
corr.py
theano/tensor/nnet/corr.py
+2
-2
downsample.py
theano/tensor/signal/downsample.py
+12
-8
test_basic.py
theano/tensor/tests/test_basic.py
+1
-1
test_blas_c.py
theano/tensor/tests/test_blas_c.py
+0
-1
test_subtensor.py
theano/tensor/tests/test_subtensor.py
+1
-1
test_flake8.py
theano/tests/test_flake8.py
+3
-2
没有找到文件。
theano/misc/tests/test_pycuda_example.py
浏览文件 @
167df2c4
...
@@ -14,7 +14,6 @@ if not cuda_ndarray.cuda_available:
...
@@ -14,7 +14,6 @@ if not cuda_ndarray.cuda_available:
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
raise
SkipTest
(
'Optional package cuda disabled'
)
raise
SkipTest
(
'Optional package cuda disabled'
)
import
theano
import
theano.tensor
as
T
import
theano.tensor
as
T
from
theano.misc.pycuda_example
import
(
PycudaElemwiseSourceModuleOp
,
from
theano.misc.pycuda_example
import
(
PycudaElemwiseSourceModuleOp
,
# PycudaElemwiseKernelOp,
# PycudaElemwiseKernelOp,
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
167df2c4
...
@@ -368,8 +368,8 @@ def local_gpu_split(node):
...
@@ -368,8 +368,8 @@ def local_gpu_split(node):
outs_clients
=
reduce
(
list
.
__add__
,
outs_clients
=
reduce
(
list
.
__add__
,
[
out
.
clients
for
out
in
node
.
outputs
])
[
out
.
clients
for
out
in
node
.
outputs
])
if
(
input
.
owner
and
isinstance
(
input
.
owner
.
op
,
HostFromGpu
)
or
if
(
input
.
owner
and
isinstance
(
input
.
owner
.
op
,
HostFromGpu
)
or
any
(
[
c
!=
'output'
and
isinstance
(
c
.
op
,
GpuFromHost
)
for
c
,
idx
any
(
c
!=
'output'
and
isinstance
(
c
.
op
,
GpuFromHost
)
for
c
,
idx
in
outs_clients
]
)):
in
outs_clients
)):
new_op
=
GpuSplit
(
node
.
op
.
len_splits
)
new_op
=
GpuSplit
(
node
.
op
.
len_splits
)
split_res
=
new_op
(
as_cuda_ndarray_variable
(
input
),
split_res
=
new_op
(
as_cuda_ndarray_variable
(
input
),
*
node
.
inputs
[
1
:],
return_list
=
True
)
*
node
.
inputs
[
1
:],
return_list
=
True
)
...
@@ -1253,9 +1253,9 @@ def local_gpu_pdbbreakpoint_op(node):
...
@@ -1253,9 +1253,9 @@ def local_gpu_pdbbreakpoint_op(node):
input_is_from_gpu
=
(
inp
.
owner
and
input_is_from_gpu
=
(
inp
.
owner
and
isinstance
(
inp
.
owner
.
op
,
HostFromGpu
))
isinstance
(
inp
.
owner
.
op
,
HostFromGpu
))
output_goes_to_gpu
=
any
(
[
c
[
0
]
!=
"output"
and
output_goes_to_gpu
=
any
(
c
[
0
]
!=
"output"
and
isinstance
(
c
[
0
]
.
op
,
GpuFromHost
)
isinstance
(
c
[
0
]
.
op
,
GpuFromHost
)
for
c
in
out
.
clients
]
)
for
c
in
out
.
clients
)
if
input_is_from_gpu
:
if
input_is_from_gpu
:
# The op should be applied on the GPU version of the input
# The op should be applied on the GPU version of the input
...
@@ -2154,9 +2154,9 @@ def local_gpualloc(node):
...
@@ -2154,9 +2154,9 @@ def local_gpualloc(node):
replace
=
True
replace
=
True
elif
all
([
c
!=
'output'
and
elif
all
([
c
!=
'output'
and
c
.
op
==
tensor
.
join
and
c
.
op
==
tensor
.
join
and
all
(
[
i
.
owner
and
all
(
i
.
owner
and
i
.
owner
.
op
in
[
host_from_gpu
,
tensor
.
alloc
]
i
.
owner
.
op
in
[
host_from_gpu
,
tensor
.
alloc
]
for
i
in
c
.
inputs
[
1
:]
])
for
i
in
c
.
inputs
[
1
:
])
for
c
,
idx
in
node
.
outputs
[
0
]
.
clients
]):
for
c
,
idx
in
node
.
outputs
[
0
]
.
clients
]):
# if the client is on gpu or alloc
# if the client is on gpu or alloc
replace
=
True
replace
=
True
...
...
theano/sandbox/cuda/tests/test_abstractconv.py
浏览文件 @
167df2c4
...
@@ -35,7 +35,8 @@ class TestConv2d(unittest.TestCase):
...
@@ -35,7 +35,8 @@ class TestConv2d(unittest.TestCase):
self
.
border_modes
=
[
"valid"
,
"full"
,
(
0
,
0
),
(
1
,
1
),
(
5
,
5
),
(
5
,
2
)]
self
.
border_modes
=
[
"valid"
,
"full"
,
(
0
,
0
),
(
1
,
1
),
(
5
,
5
),
(
5
,
2
)]
self
.
filter_flip
=
[
True
,
False
]
self
.
filter_flip
=
[
True
,
False
]
def
get_output_shape
(
self
,
inputs_shape
,
filters_shape
,
subsample
,
border_mode
):
def
get_output_shape
(
self
,
inputs_shape
,
filters_shape
,
subsample
,
border_mode
):
if
border_mode
==
"valid"
:
if
border_mode
==
"valid"
:
border_mode
=
(
0
,
0
)
border_mode
=
(
0
,
0
)
if
border_mode
==
"full"
:
if
border_mode
==
"full"
:
...
@@ -139,8 +140,10 @@ class TestConv2d(unittest.TestCase):
...
@@ -139,8 +140,10 @@ class TestConv2d(unittest.TestCase):
utt
.
verify_grad
(
abstract_conv2d_gradweight
,
[
inputs_val
,
output_val
],
utt
.
verify_grad
(
abstract_conv2d_gradweight
,
[
inputs_val
,
output_val
],
mode
=
mode
,
eps
=
1
)
mode
=
mode
,
eps
=
1
)
def
run_gradinput
(
self
,
inputs_shape
,
filters_shape
,
output_shape
,
ref
=
dnn_gradinput
,
def
run_gradinput
(
self
,
inputs_shape
,
filters_shape
,
subsample
=
(
1
,
1
),
filter_flip
=
True
,
verify_grad
=
True
,
mode
=
mode_without_gpu
,
output_shape
,
ref
=
dnn_gradinput
,
subsample
=
(
1
,
1
),
filter_flip
=
True
,
verify_grad
=
True
,
mode
=
mode_without_gpu
,
border_mode
=
'valid'
,
device
=
'cpu'
,
provide_shape
=
False
):
border_mode
=
'valid'
,
device
=
'cpu'
,
provide_shape
=
False
):
output_val
=
numpy
.
random
.
random
(
output_shape
)
.
astype
(
'float32'
)
output_val
=
numpy
.
random
.
random
(
output_shape
)
.
astype
(
'float32'
)
...
@@ -188,7 +191,6 @@ class TestConv2d(unittest.TestCase):
...
@@ -188,7 +191,6 @@ class TestConv2d(unittest.TestCase):
mode
=
mode_with_gpu
mode
=
mode_with_gpu
# provide_shape is not used by the CuDNN impementation
# provide_shape is not used by the CuDNN impementation
provide_shape
=
False
provide_shape
=
False
for
(
i
,
f
),
s
,
b
,
flip
in
itertools
.
product
(
for
(
i
,
f
),
s
,
b
,
flip
in
itertools
.
product
(
zip
(
self
.
inputs_shapes
,
self
.
filters_shapes
),
zip
(
self
.
inputs_shapes
,
self
.
filters_shapes
),
self
.
subsamples
,
self
.
subsamples
,
...
@@ -210,7 +212,7 @@ class TestConv2d(unittest.TestCase):
...
@@ -210,7 +212,7 @@ class TestConv2d(unittest.TestCase):
provide_shape
=
provide_shape
,
border_mode
=
b
,
provide_shape
=
provide_shape
,
border_mode
=
b
,
filter_flip
=
flip
)
filter_flip
=
flip
)
def
test_gpucormm_conv
(
self
):
def
test_gpucor
r
mm_conv
(
self
):
if
not
dnn_available
():
if
not
dnn_available
():
raise
SkipTest
(
cuda
.
dnn
.
dnn_available
.
msg
)
raise
SkipTest
(
cuda
.
dnn
.
dnn_available
.
msg
)
...
...
theano/sandbox/cuda/tests/test_basic_ops.py
浏览文件 @
167df2c4
...
@@ -873,8 +873,6 @@ def test_hostfromgpu_shape_i():
...
@@ -873,8 +873,6 @@ def test_hostfromgpu_shape_i():
# -----------------------------------------------------------------------
# -----------------------------------------------------------------------
import
theano.sandbox.cuda
as
cuda_ndarray
def
test_gpujoin_assert_cndas
():
def
test_gpujoin_assert_cndas
():
# this will end up being an ndarray, as it's float64
# this will end up being an ndarray, as it's float64
...
...
theano/scan_module/scan_perform_ext.py
浏览文件 @
167df2c4
import
errno
import
errno
import
logging
import
logging
import
os
import
os
from
six.moves
import
reload_module
as
reload
import
sys
import
sys
import
warnings
import
warnings
...
...
theano/tensor/nnet/corr.py
浏览文件 @
167df2c4
...
@@ -179,13 +179,13 @@ class BaseCorrMM(gof.Op):
...
@@ -179,13 +179,13 @@ class BaseCorrMM(gof.Op):
raise
ValueError
(
"height must be given for backprop with vertical sampling or border_mode='half'"
)
raise
ValueError
(
"height must be given for backprop with vertical sampling or border_mode='half'"
)
height
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
height
height
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
height
else
:
else
:
height
=
'
NULL
'
height
=
'
-1
'
if
((
direction
!=
0
)
and
(
dW
!=
1
))
or
((
direction
==
1
)
and
(
padW
==
-
1
)):
if
((
direction
!=
0
)
and
(
dW
!=
1
))
or
((
direction
==
1
)
and
(
padW
==
-
1
)):
if
not
width
:
if
not
width
:
raise
ValueError
(
"width must be given for backprop with horizontal sampling or border_mode='half'"
)
raise
ValueError
(
"width must be given for backprop with horizontal sampling or border_mode='half'"
)
width
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
width
width
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
width
else
:
else
:
width
=
'
NULL
'
width
=
'
-1
'
sub
=
sub
.
copy
()
sub
=
sub
.
copy
()
sub
.
update
(
locals
())
sub
.
update
(
locals
())
...
...
theano/tensor/signal/downsample.py
浏览文件 @
167df2c4
...
@@ -63,7 +63,7 @@ def max_pool_2d(input, ds, ignore_border=None, st=None, padding=(0, 0),
...
@@ -63,7 +63,7 @@ def max_pool_2d(input, ds, ignore_border=None, st=None, padding=(0, 0),
ignore_border : bool (default None, will print a warning and set to False)
ignore_border : bool (default None, will print a warning and set to False)
When True, (5,5) input with ds=(2,2) will generate a (2,2) output.
When True, (5,5) input with ds=(2,2) will generate a (2,2) output.
(3,3) otherwise.
(3,3) otherwise.
st : tuple of
lenght 2
st : tuple of
two ints
Stride size, which is the number of shifts over rows/cols to get the
Stride size, which is the number of shifts over rows/cols to get the
next pool region. If st is None, it is considered equal to ds
next pool region. If st is None, it is considered equal to ds
(no overlap on pooling regions).
(no overlap on pooling regions).
...
@@ -80,13 +80,17 @@ def max_pool_2d(input, ds, ignore_border=None, st=None, padding=(0, 0),
...
@@ -80,13 +80,17 @@ def max_pool_2d(input, ds, ignore_border=None, st=None, padding=(0, 0),
if
input
.
ndim
<
2
:
if
input
.
ndim
<
2
:
raise
NotImplementedError
(
'max_pool_2d requires a dimension >= 2'
)
raise
NotImplementedError
(
'max_pool_2d requires a dimension >= 2'
)
if
ignore_border
is
None
:
if
ignore_border
is
None
:
warnings
.
warn
(
"max_pool_2d() will have the parameter ignore_border"
warnings
.
warn
(
" default value changed to True (currently"
"max_pool_2d() will have the parameter ignore_border"
" False). To have consistent behavior with all Theano"
" default value changed to True (currently"
" version, explicitly add the parameter"
" False). To have consistent behavior with all Theano"
" ignore_border=True. (this is also faster than"
" version, explicitly add the parameter ignore_border=True."
" ignore_border=False)"
,
" On the GPU, using ignore_border=False is needed to use CuDNN."
stacklevel
=
2
)
" When using ignore_border=False and not using CuDNN, the only"
" GPU combination supported is when"
" `ds == st and padding == (0, 0) and mode == 'max'`."
" Otherwise, the convolution will be executed on CPU."
,
stacklevel
=
2
)
ignore_border
=
False
ignore_border
=
False
if
input
.
ndim
==
4
:
if
input
.
ndim
==
4
:
op
=
DownsampleFactorMax
(
ds
,
ignore_border
,
st
=
st
,
padding
=
padding
,
op
=
DownsampleFactorMax
(
ds
,
ignore_border
,
st
=
st
,
padding
=
padding
,
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
167df2c4
...
@@ -5020,7 +5020,7 @@ class T_reshape(utt.InferShapeTester, utt.TestOptimizationMixin):
...
@@ -5020,7 +5020,7 @@ class T_reshape(utt.InferShapeTester, utt.TestOptimizationMixin):
# The tag canonicalize is needed for the shape test in FAST_COMPILE
# The tag canonicalize is needed for the shape test in FAST_COMPILE
self
.
mode
=
mode
self
.
mode
=
mode
self
.
ignore_topo
=
ignore_topo
self
.
ignore_topo
=
ignore_topo
return
super
(
T_reshape
,
self
)
.
__init__
(
name
)
super
(
T_reshape
,
self
)
.
__init__
(
name
)
def
function
(
self
,
inputs
,
outputs
):
def
function
(
self
,
inputs
,
outputs
):
f
=
function
(
inputs
,
outputs
,
mode
=
self
.
mode
)
f
=
function
(
inputs
,
outputs
,
mode
=
self
.
mode
)
...
...
theano/tensor/tests/test_blas_c.py
浏览文件 @
167df2c4
...
@@ -12,7 +12,6 @@ from theano.tensor.blas_scipy import ScipyGer
...
@@ -12,7 +12,6 @@ from theano.tensor.blas_scipy import ScipyGer
from
theano.tensor.blas
import
Ger
from
theano.tensor.blas
import
Ger
from
theano.tensor.blas_c
import
CGemv
from
theano.tensor.blas_c
import
CGemv
from
theano.tensor.blas_scipy
import
ScipyGer
from
theano.tensor.blas
import
Gemv
from
theano.tensor.blas
import
Gemv
from
theano.tensor.blas_c
import
check_force_gemv_init
from
theano.tensor.blas_c
import
check_force_gemv_init
...
...
theano/tensor/tests/test_subtensor.py
浏览文件 @
167df2c4
...
@@ -1264,7 +1264,7 @@ class TestAdvancedSubtensor(unittest.TestCase):
...
@@ -1264,7 +1264,7 @@ class TestAdvancedSubtensor(unittest.TestCase):
self
.
mode
=
mode
self
.
mode
=
mode
self
.
dtype
=
dtype
self
.
dtype
=
dtype
self
.
ignore_topo
=
ignore_topo
self
.
ignore_topo
=
ignore_topo
return
super
(
TestAdvancedSubtensor
,
self
)
.
__init__
(
name
)
super
(
TestAdvancedSubtensor
,
self
)
.
__init__
(
name
)
def
setUp
(
self
):
def
setUp
(
self
):
self
.
s
=
iscalar
()
self
.
s
=
iscalar
()
...
...
theano/tests/test_flake8.py
浏览文件 @
167df2c4
...
@@ -183,7 +183,7 @@ whitelist_flake8 = [
...
@@ -183,7 +183,7 @@ whitelist_flake8 = [
]
]
def
list_files
(
dir_path
=
theano
.
__path__
[
0
],
pattern
=
'*.py'
):
def
list_files
(
dir_path
=
theano
.
__path__
[
0
],
pattern
=
'*.py'
,
no_match
=
".#"
):
"""
"""
List all files under theano's path.
List all files under theano's path.
"""
"""
...
@@ -192,7 +192,8 @@ def list_files(dir_path=theano.__path__[0], pattern='*.py'):
...
@@ -192,7 +192,8 @@ def list_files(dir_path=theano.__path__[0], pattern='*.py'):
for
f
in
files
:
for
f
in
files
:
if
fnmatch
(
f
,
pattern
):
if
fnmatch
(
f
,
pattern
):
path
=
os
.
path
.
join
(
dir
,
f
)
path
=
os
.
path
.
join
(
dir
,
f
)
files_list
.
append
(
path
)
if
not
f
.
startswith
(
no_match
):
files_list
.
append
(
path
)
return
files_list
return
files_list
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论