Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5c8876ba
提交
5c8876ba
authored
8月 16, 2016
作者:
Gijs van Tulder
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add dnn_gradweight3d and dnn_gradinput3d.
上级
289c3bd4
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
53 行增加
和
0 行删除
+53
-0
dnn.py
theano/sandbox/cuda/dnn.py
+53
-0
没有找到文件。
theano/sandbox/cuda/dnn.py
浏览文件 @
5c8876ba
...
@@ -1319,6 +1319,32 @@ def dnn_gradweight(img, topgrad,
...
@@ -1319,6 +1319,32 @@ def dnn_gradweight(img, topgrad,
return
GpuDnnConvGradW
()(
img
,
topgrad
,
out
,
desc
)
return
GpuDnnConvGradW
()(
img
,
topgrad
,
out
,
desc
)
def
dnn_gradweight3d
(
img
,
topgrad
,
kerns_shp
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
,
1
),
conv_mode
=
'conv'
):
"""
GPU convolution gradient with respect to weight using cuDNN from NVIDIA.
The memory layout to use is 'bct01', that is 'batch', 'channel',
'first dim', 'second dim' in that order.
FIXME parameters doc
:warning: The cuDNN library only works with GPU that have a compute
capability of 3.0 or higer. This means that older GPU will not
work with this Op.
"""
img
=
gpu_contiguous
(
img
)
topgrad
=
gpu_contiguous
(
topgrad
)
kerns_shp
=
theano
.
tensor
.
as_tensor_variable
(
kerns_shp
)
desc
=
GpuDnnConvDesc
(
border_mode
=
border_mode
,
subsample
=
subsample
,
conv_mode
=
conv_mode
)(
img
.
shape
,
kerns_shp
)
out
=
gpu_alloc_empty
(
*
kerns_shp
)
return
GpuDnnConv3dGradW
()(
img
,
topgrad
,
out
,
desc
)
def
dnn_gradinput
(
kerns
,
topgrad
,
def
dnn_gradinput
(
kerns
,
topgrad
,
img_shp
,
img_shp
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
...
@@ -1346,6 +1372,33 @@ def dnn_gradinput(kerns, topgrad,
...
@@ -1346,6 +1372,33 @@ def dnn_gradinput(kerns, topgrad,
return
GpuDnnConvGradI
()(
kerns
,
topgrad
,
out
,
desc
)
return
GpuDnnConvGradI
()(
kerns
,
topgrad
,
out
,
desc
)
def
dnn_gradinput3d
(
kerns
,
topgrad
,
img_shp
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
conv_mode
=
'conv'
):
"""
GPU convolution gradient with respect to input using cuDNN from NVIDIA.
The memory layout to use is 'bct01', that is 'batch', 'channel',
'first dim', 'second dim' in that order.
FIXME parameters doc
:warning: The cuDNN library only works with GPU that have a compute
capability of 3.0 or higer. This means that older GPU will not
work with this Op.
"""
kerns
=
gpu_contiguous
(
kerns
)
topgrad
=
gpu_contiguous
(
topgrad
)
img_shp
=
theano
.
tensor
.
as_tensor_variable
(
img_shp
)
desc
=
GpuDnnConvDesc
(
border_mode
=
border_mode
,
subsample
=
subsample
,
conv_mode
=
conv_mode
)(
img_shp
,
kerns
.
shape
)
out
=
gpu_alloc_empty
(
*
img_shp
)
return
GpuDnnConv3dGradI
()(
kerns
,
topgrad
,
out
,
desc
)
class
GpuDnnPoolDesc
(
GpuOp
):
class
GpuDnnPoolDesc
(
GpuOp
):
"""
"""
This Op builds a pooling descriptor for use in the other pooling operations.
This Op builds a pooling descriptor for use in the other pooling operations.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论