Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d68ac777
提交
d68ac777
authored
5月 11, 2017
作者:
Gabe Schwartz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Documentation, added __setstate__, small fixes.
上级
9f37bce1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
29 行增加
和
15 行删除
+29
-15
dnn.py
theano/gpuarray/dnn.py
+29
-15
没有找到文件。
theano/gpuarray/dnn.py
浏览文件 @
d68ac777
...
...
@@ -131,7 +131,7 @@ def _dnn_check_version():
if
v
<
5000
:
return
False
,
"cuDNN version is too old. Update to v5, was
%
d."
%
v
# 5200 should not print warning with cudnn 5.1 final.
if
v
>
602
0
:
if
v
>
=
610
0
:
warnings
.
warn
(
"Your cuDNN version is more recent than "
"Theano. If you encounter problems, try "
"updating Theano or downgrading cuDNN to "
...
...
@@ -401,7 +401,6 @@ class GpuDnnConvDesc(COp):
assert
conv_mode
in
(
'conv'
,
'cross'
)
self
.
conv_mode
=
conv_mode
assert
len
(
dilation
)
in
(
2
,
3
)
assert
len
(
dilation
)
==
len
(
subsample
)
self
.
dilation
=
dilation
...
...
@@ -487,6 +486,11 @@ class GpuDnnConvDesc(COp):
def
c_code_cache_version
(
self
):
return
(
super
(
GpuDnnConvDesc
,
self
)
.
c_code_cache_version
(),
version
())
def
__setstate__
(
self
,
d
):
self
.
__dict__
.
update
(
d
)
if
not
hasattr
(
self
,
"dilation"
):
self
.
dilation
=
(
1
,)
*
len
(
self
.
subsample
)
# scalar constants
_zero
=
constant
(
np
.
asarray
(
0.0
,
dtype
=
'float64'
))
...
...
@@ -935,16 +939,20 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1), dilation=(1, 1),
could be directly specified by an integer or a pair of integers.
subsample
Perform subsampling of the output (default: (1, 1)).
dilation
Filter dilation factor. A dilation factor of d is equivalent to a
convolution with d - 1 zeros inserted between neighboring filter
values.
conv_mode
Perform convolution (kernels flipped) or cross-correlation.
One of 'conv', 'cross' (default: 'conv').
direction_hint
Used by graph optimizers to change algorithm choice.
By default, GpuDnnConv will be used to carry out the convolution.
If border_mode is 'valid', subsample is (1, 1)
and direction_hint is
'bprop weights', it will use GpuDnnConvGradW.
If border_mode is 'full', subsample is (1, 1)
and direction_hint is
*not* 'forward!', it will use GpuDnnConvGradI.
If border_mode is 'valid', subsample is (1, 1)
, dilation is (1, 1), and
direction_hint is
'bprop weights', it will use GpuDnnConvGradW.
If border_mode is 'full', subsample is (1, 1)
, dilation is (1, 1), and
direction_hint is
*not* 'forward!', it will use GpuDnnConvGradI.
This parameter is used internally by graph optimizers and may be
removed at any time without a deprecation period. You have been warned.
algo : {'none', 'small', 'large', 'fft', 'guess_once', 'guess_on_shape_change', 'time_once', 'time_on_shape_change'}
...
...
@@ -1053,17 +1061,23 @@ def dnn_conv3d(img, kerns, border_mode='valid', subsample=(1, 1, 1), dilation=(1
One of 'valid', 'full', 'half'; additionally, the padding size
could be directly specified by an integer or a pair of integers.
subsample
Perform subsampling of the output (default: (1, 1)).
Perform subsampling of the output (default: (1, 1, 1)).
dilation
Filter dilation factor. A dilation factor of d is equivalent to a
convolution with d - 1 zeros inserted between neighboring filter
values.
conv_mode
Perform convolution (kernels flipped) or cross-correlation.
One of 'conv', 'cross' (default: 'conv').
direction_hint
Used by graph optimizers to change algorithm choice.
By default, GpuDnnConv will be used to carry out the convolution.
If border_mode is 'valid', subsample is (1, 1) and direction_hint is
'bprop weights', it will use GpuDnnConvGradW.
If border_mode is 'full', subsample is (1, 1) and direction_hint is
*not* 'forward!', it will use GpuDnnConvGradI.
If border_mode is 'valid', subsample is (1, 1, 1), dilation is
(1, 1, 1), and direction_hint is 'bprop weights', it will use
GpuDnnConvGradW.
If border_mode is 'full', subsample is (1, 1, 1), dilation is
(1, 1, 1), and direction_hint is *not* 'forward!', it will use
GpuDnnConvGradI.
This parameter is used internally by graph optimizers and may be
removed at any time without a deprecation period. You have been warned.
algo : convolution implementation to use. Only 'none' is implemented
...
...
@@ -1168,12 +1182,12 @@ def dnn_gradweight(img, topgrad, kerns_shp, border_mode='valid',
def
dnn_gradweight3d
(
img
,
topgrad
,
kerns_shp
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
,
1
),
conv_mode
=
'conv'
,
precision
=
None
):
subsample
=
(
1
,
1
,
1
),
dilation
=
(
1
,
1
,
1
),
conv_mode
=
'conv'
,
precision
=
None
):
"""
3d version of dnn_gradweight
"""
return
dnn_gradweight
(
img
,
topgrad
,
kerns_shp
,
border_mode
,
subsample
,
conv_mode
,
precision
)
subsample
,
dilation
,
conv_mode
,
precision
)
def
dnn_gradinput
(
kerns
,
topgrad
,
img_shp
,
border_mode
=
'valid'
,
...
...
@@ -1196,12 +1210,12 @@ def dnn_gradinput(kerns, topgrad, img_shp, border_mode='valid',
def
dnn_gradinput3d
(
kerns
,
topgrad
,
img_shp
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
,
1
),
conv_mode
=
'conv'
,
precision
=
None
):
subsample
=
(
1
,
1
,
1
),
dilation
=
(
1
,
1
,
1
),
conv_mode
=
'conv'
,
precision
=
None
):
"""
3d version of `dnn_gradinput`.
"""
return
dnn_gradinput
(
kerns
,
topgrad
,
img_shp
,
border_mode
,
subsample
,
conv_mode
,
precision
)
dilation
,
conv_mode
,
precision
)
class
GpuDnnPoolDesc
(
Op
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论