Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7a78f453
提交
7a78f453
authored
2月 06, 2015
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2480 from nouiz/conv
Conv and meta_conv
上级
c907bf60
876eb091
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
24 行增加
和
13 行删除
+24
-13
opt.py
theano/gof/opt.py
+3
-1
blas.py
theano/sandbox/cuda/blas.py
+12
-0
opt.py
theano/sandbox/cuda/opt.py
+7
-10
test_conv_cuda_ndarray.py
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
+2
-2
没有找到文件。
theano/gof/opt.py
浏览文件 @
7a78f453
...
@@ -857,7 +857,9 @@ class LocalMetaOptimizer(LocalOptimizer):
...
@@ -857,7 +857,9 @@ class LocalMetaOptimizer(LocalOptimizer):
elif
hasattr
(
input
.
tag
,
'test_value'
):
elif
hasattr
(
input
.
tag
,
'test_value'
):
givens
[
input
]
=
theano
.
shared
(
givens
[
input
]
=
theano
.
shared
(
input
.
type
.
filter
(
input
.
tag
.
test_value
),
input
.
type
.
filter
(
input
.
tag
.
test_value
),
input
.
name
,
borrow
=
True
)
input
.
name
,
broadcastable
=
input
.
broadcastable
,
borrow
=
True
)
else
:
else
:
missing
.
add
(
input
)
missing
.
add
(
input
)
if
missing
:
if
missing
:
...
...
theano/sandbox/cuda/blas.py
浏览文件 @
7a78f453
...
@@ -1541,6 +1541,18 @@ class GpuConv(GpuOp):
...
@@ -1541,6 +1541,18 @@ class GpuConv(GpuOp):
to enable them.
to enable them.
"""
"""
self
.
border_mode
=
border_mode
self
.
border_mode
=
border_mode
if
version
!=
-
1
:
raise
Exception
(
"""GpuConv with version!=-1 is disabled as we do not
test it anymore. It probably work, so you probably can
just comment this error and use it. But we want to
make sure you know about that. Also, this Op is pretty
slow and isn't used by default anymore. We strongly
suggest to use GpuCorrMM that is much faster and
implement all the functionality (at a cost of some
extra memory usage). If you can use cuDNN, that is
even better.
"""
)
self
.
subsample
=
subsample
self
.
subsample
=
subsample
if
logical_img_hw
is
not
None
:
if
logical_img_hw
is
not
None
:
h
,
w
=
logical_img_hw
h
,
w
=
logical_img_hw
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
7a78f453
...
@@ -1285,16 +1285,11 @@ def local_conv_gemm(node):
...
@@ -1285,16 +1285,11 @@ def local_conv_gemm(node):
img
,
kern
=
node
.
inputs
img
,
kern
=
node
.
inputs
border_mode
=
node
.
op
.
border_mode
border_mode
=
node
.
op
.
border_mode
subsample
=
node
.
op
.
subsample
subsample
=
node
.
op
.
subsample
pad
=
(
0
,
0
)
if
(
border_mode
==
'valid'
)
or
(
subsample
!=
(
1
,
1
)):
if
(
border_mode
==
'full'
)
and
(
subsample
!=
(
1
,
1
)):
# need to simulate this via a padded valid convolution
pad
=
'full'
border_mode
=
'valid'
if
(
border_mode
==
'valid'
):
# need to flip the kernel for valid convolution
# need to flip the kernel for valid convolution
kern
=
kern
[:,
:,
::
-
1
,
::
-
1
]
kern
=
kern
[:,
:,
::
-
1
,
::
-
1
]
# By default use GpuCorrMM
# By default use GpuCorrMM
rval
=
GpuCorrMM
(
'valid'
,
subsample
,
pad
)(
rval
=
GpuCorrMM
(
border_mode
,
subsample
)(
gpu_contiguous
(
img
),
gpu_contiguous
(
kern
))
gpu_contiguous
(
img
),
gpu_contiguous
(
kern
))
# call GpuCorrMM_gradWeights if good
# call GpuCorrMM_gradWeights if good
...
@@ -1323,7 +1318,7 @@ def local_conv_gemm(node):
...
@@ -1323,7 +1318,7 @@ def local_conv_gemm(node):
# because we are not allowed to replace a CudaNdarray with
# because we are not allowed to replace a CudaNdarray with
# a DimShuffle instance in a graph optimization)
# a DimShuffle instance in a graph optimization)
rval
=
theano
.
sandbox
.
cuda
.
as_cuda_ndarray_variable
(
rval
=
theano
.
sandbox
.
cuda
.
as_cuda_ndarray_variable
(
GpuCorrMM_gradWeights
(
'valid'
,
subsample
,
pad
)(
GpuCorrMM_gradWeights
(
border_mode
,
subsample
)(
gpu_contiguous
(
img
.
dimshuffle
(
1
,
0
,
2
,
3
)),
gpu_contiguous
(
img
.
dimshuffle
(
1
,
0
,
2
,
3
)),
gpu_contiguous
(
kern
.
dimshuffle
(
1
,
0
,
2
,
3
))
gpu_contiguous
(
kern
.
dimshuffle
(
1
,
0
,
2
,
3
))
)
.
dimshuffle
(
1
,
0
,
2
,
3
))
)
.
dimshuffle
(
1
,
0
,
2
,
3
))
...
@@ -1331,7 +1326,7 @@ def local_conv_gemm(node):
...
@@ -1331,7 +1326,7 @@ def local_conv_gemm(node):
# need to dimshuffle the kernel for full convolution
# need to dimshuffle the kernel for full convolution
kern
=
kern
.
dimshuffle
(
1
,
0
,
2
,
3
)
kern
=
kern
.
dimshuffle
(
1
,
0
,
2
,
3
)
# call GpuCorrMM_gradInputs
# call GpuCorrMM_gradInputs
rval
=
GpuCorrMM_gradInputs
(
'valid'
,
subsample
,
pad
)(
rval
=
GpuCorrMM_gradInputs
(
'valid'
,
subsample
)(
gpu_contiguous
(
kern
),
gpu_contiguous
(
img
))
gpu_contiguous
(
kern
),
gpu_contiguous
(
img
))
if
node
.
outputs
[
0
]
.
broadcastable
!=
rval
.
broadcastable
:
if
node
.
outputs
[
0
]
.
broadcastable
!=
rval
.
broadcastable
:
# With given shape information, conv2d_fft may return a different
# With given shape information, conv2d_fft may return a different
...
@@ -1413,7 +1408,9 @@ class ConvMetaOptimizer(LocalCudaMetaOptimizer):
...
@@ -1413,7 +1408,9 @@ class ConvMetaOptimizer(LocalCudaMetaOptimizer):
# allow_downcast=True),
# allow_downcast=True),
numpy
.
require
(
numpy
.
random
.
randn
(
*
shape
),
numpy
.
require
(
numpy
.
random
.
randn
(
*
shape
),
dtype
=
var
.
dtype
),
dtype
=
var
.
dtype
),
var
.
name
,
borrow
=
True
)
var
.
name
,
broadcastable
=
var
.
broadcastable
,
borrow
=
True
)
# return mapping
# return mapping
return
result
return
result
...
...
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
浏览文件 @
7a78f453
...
@@ -556,8 +556,8 @@ def _test_subsample(cls, mode, version_valid=[-1], version_full=[-1]):
...
@@ -556,8 +556,8 @@ def _test_subsample(cls, mode, version_valid=[-1], version_full=[-1]):
def
test_subsample
():
def
test_subsample
():
for
t
in
_test_subsample
(
None
,
theano_mode
,
for
t
in
_test_subsample
(
None
,
theano_mode
,
version_valid
=
[
-
2
,
-
1
,
1
,
3
,
11
,
12
],
version_valid
=
[
-
1
],
version_full
=
[
-
2
,
-
1
]):
version_full
=
[
-
1
]):
yield
t
yield
t
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论