Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
987a15a5
提交
987a15a5
authored
11月 19, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
better error message
上级
d6e5dc8c
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
26 行增加
和
14 行删除
+26
-14
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+2
-1
dnn.py
theano/sandbox/cuda/dnn.py
+24
-13
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
987a15a5
...
@@ -2345,7 +2345,8 @@ class GpuReshape(tensor.Reshape, GpuOp):
...
@@ -2345,7 +2345,8 @@ class GpuReshape(tensor.Reshape, GpuOp):
shp
=
shp_new
shp
=
shp_new
else
:
else
:
raise
ValueError
(
"total size of new array must be unchanged"
)
raise
ValueError
(
"total size of new array must be unchanged"
,
x
.
shape
,
shp
)
out
[
0
]
=
x
.
reshape
(
tuple
(
shp
))
out
[
0
]
=
x
.
reshape
(
tuple
(
shp
))
...
...
theano/sandbox/cuda/dnn.py
浏览文件 @
987a15a5
...
@@ -693,7 +693,8 @@ int wsX, wsY, strideX, strideY;
...
@@ -693,7 +693,8 @@ int wsX, wsY, strideX, strideY;
err
%(name)
s = cudnnGetPoolingDescriptor(
%(desc)
s, &mode, &wsX, &wsY, &strideX, &strideY);
err
%(name)
s = cudnnGetPoolingDescriptor(
%(desc)
s, &mode, &wsX, &wsY, &strideX, &strideY);
if (err
%(name)
s != CUDNN_STATUS_SUCCESS) {
if (err
%(name)
s != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, "error doing operation:
%%
s",
PyErr_Format(PyExc_RuntimeError,
"GpuDnnPool: error doing cudnnGetPoolingDescriptor operation:
%%
s",
cudnnGetErrorString(err
%(name)
s));
cudnnGetErrorString(err
%(name)
s));
%(fail)
s
%(fail)
s
}
}
...
@@ -717,7 +718,8 @@ _handle,
...
@@ -717,7 +718,8 @@ _handle,
%(output_desc)
s, CudaNdarray_DEV_DATA(
%(out)
s)
%(output_desc)
s, CudaNdarray_DEV_DATA(
%(out)
s)
);
);
if (err
%(name)
s != CUDNN_STATUS_SUCCESS) {
if (err
%(name)
s != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, "error doing operation:
%%
s",
PyErr_Format(PyExc_RuntimeError,
"GpuDnnPool: error doing cudnnPoolingForward operation:
%%
s",
cudnnGetErrorString(err
%(name)
s));
cudnnGetErrorString(err
%(name)
s));
%(fail)
s
%(fail)
s
}
}
...
@@ -744,7 +746,7 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) {
...
@@ -744,7 +746,7 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) {
return
[[
1
],
[
0
]]
return
[[
1
],
[
0
]]
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
2
,)
return
(
3
,)
class
GpuDnnPoolGrad
(
DnnBase
):
class
GpuDnnPoolGrad
(
DnnBase
):
...
@@ -794,22 +796,26 @@ input_grad%(id)d = NULL;
...
@@ -794,22 +796,26 @@ input_grad%(id)d = NULL;
output
%(id)
d = NULL;
output
%(id)
d = NULL;
output_grad
%(id)
d = NULL;
output_grad
%(id)
d = NULL;
if ((err
%(id)
d = cudnnCreateTensor4dDescriptor(&input
%(id)
d)) != CUDNN_STATUS_SUCCESS) {
if ((err
%(id)
d = cudnnCreateTensor4dDescriptor(&input
%(id)
d)) != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_MemoryError, "could not allocate tensor4d descriptor "
PyErr_Format(PyExc_MemoryError,
"GpuDnnPoolGrad: could not allocate tensor4d descriptor "
"(input):
%%
s", cudnnGetErrorString(err
%(id)
d));
"(input):
%%
s", cudnnGetErrorString(err
%(id)
d));
%(fail)
s
%(fail)
s
}
}
if ((err
%(id)
d = cudnnCreateTensor4dDescriptor(&input_grad
%(id)
d)) != CUDNN_STATUS_SUCCESS) {
if ((err
%(id)
d = cudnnCreateTensor4dDescriptor(&input_grad
%(id)
d)) != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_MemoryError, "could not allocate tensor4d descriptor "
PyErr_Format(PyExc_MemoryError,
"GpuDnnPoolGrad: could not allocate tensor4d descriptor "
"(input_grad):
%%
s", cudnnGetErrorString(err
%(id)
d));
"(input_grad):
%%
s", cudnnGetErrorString(err
%(id)
d));
%(fail)
s
%(fail)
s
}
}
if ((err
%(id)
d = cudnnCreateTensor4dDescriptor(&output
%(id)
d)) != CUDNN_STATUS_SUCCESS) {
if ((err
%(id)
d = cudnnCreateTensor4dDescriptor(&output
%(id)
d)) != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_MemoryError, "could not allocate tensor4d descriptor "
PyErr_Format(PyExc_MemoryError,
"GpuDnnPoolGrad: could not allocate tensor4d descriptor "
"(output):
%%
s", cudnnGetErrorString(err
%(id)
d));
"(output):
%%
s", cudnnGetErrorString(err
%(id)
d));
%(fail)
s
%(fail)
s
}
}
if ((err
%(id)
d = cudnnCreateTensor4dDescriptor(&output_grad
%(id)
d)) != CUDNN_STATUS_SUCCESS) {
if ((err
%(id)
d = cudnnCreateTensor4dDescriptor(&output_grad
%(id)
d)) != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_MemoryError, "could not allocate tensor4d descriptor "
PyErr_Format(PyExc_MemoryError,
"GpuDnnPoolGrad: could not allocate tensor4d descriptor "
"(output_grad):
%%
s", cudnnGetErrorString(err
%(id)
d));
"(output_grad):
%%
s", cudnnGetErrorString(err
%(id)
d));
%(fail)
s
%(fail)
s
}
}
...
@@ -843,23 +849,27 @@ if (output_grad%(id)d != NULL) { cudnnDestroyTensor4dDescriptor(output_grad%(id)
...
@@ -843,23 +849,27 @@ if (output_grad%(id)d != NULL) { cudnnDestroyTensor4dDescriptor(output_grad%(id)
cudnnStatus_t err
%(name)
s;
cudnnStatus_t err
%(name)
s;
if (!CudaNdarray_is_c_contiguous(
%(input)
s)) {
if (!CudaNdarray_is_c_contiguous(
%(input)
s)) {
PyErr_SetString(PyExc_ValueError, "Only contiguous inputs are supported.");
PyErr_SetString(PyExc_ValueError,
"GpuDnnPoolGrad: Only contiguous inputs are supported.");
%(fail)
s
%(fail)
s
}
}
if (!CudaNdarray_is_c_contiguous(
%(input_grad)
s)) {
if (!CudaNdarray_is_c_contiguous(
%(input_grad)
s)) {
PyErr_SetString(PyExc_ValueError, "Only contiguous input gradients are supported.");
PyErr_SetString(PyExc_ValueError,
"GpuDnnPoolGrad: Only contiguous input gradients are supported.");
%(fail)
s
%(fail)
s
}
}
if (!CudaNdarray_is_c_contiguous(
%(output)
s)) {
if (!CudaNdarray_is_c_contiguous(
%(output)
s)) {
PyErr_SetString(PyExc_ValueError, "Only contiguous outputs are supported.");
PyErr_SetString(PyExc_ValueError,
"GpuDnnPoolGrad: Only contiguous outputs are supported.");
%(fail)
s
%(fail)
s
}
}
%(set_in)
s
%(set_in)
s
if (CudaNdarray_prep_output(&
%(output_grad)
s, 4, CudaNdarray_HOST_DIMS(
%(output)
s)) != 0)
if (CudaNdarray_prep_output(&
%(output_grad)
s, 4,
CudaNdarray_HOST_DIMS(
%(output)
s)) != 0)
{
{
%(fail)
s
%(fail)
s
}
}
...
@@ -875,7 +885,8 @@ _handle,
...
@@ -875,7 +885,8 @@ _handle,
%(output_grad_desc)
s, CudaNdarray_DEV_DATA(
%(output_grad)
s)
%(output_grad_desc)
s, CudaNdarray_DEV_DATA(
%(output_grad)
s)
);
);
if (err
%(name)
s != CUDNN_STATUS_SUCCESS) {
if (err
%(name)
s != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, "error doing operation:
%%
s",
PyErr_Format(PyExc_RuntimeError,
"GpuDnnPoolGrad: error doing operation:
%%
s",
cudnnGetErrorString(err
%(name)
s));
cudnnGetErrorString(err
%(name)
s));
%(fail)
s
%(fail)
s
}
}
...
@@ -889,7 +900,7 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) {
...
@@ -889,7 +900,7 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) {
output_grad_desc
=
"output_grad"
+
str
(
sub
[
'struct_id'
]))
output_grad_desc
=
"output_grad"
+
str
(
sub
[
'struct_id'
]))
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
2
,)
return
(
3
,)
def
dnn_pool
(
img
,
ws
,
stride
=
(
1
,
1
),
mode
=
'max'
):
def
dnn_pool
(
img
,
ws
,
stride
=
(
1
,
1
),
mode
=
'max'
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论