Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2d39527c
提交
2d39527c
authored
3月 26, 2013
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix C code of GpuDownsampleFactorMaxGrad.
It was causing errors when running with cuda-memcheck, or when running on Mac OS X.
上级
cc4fc100
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
18 行删除
+17
-18
blas.py
theano/sandbox/cuda/blas.py
+17
-18
没有找到文件。
theano/sandbox/cuda/blas.py
浏览文件 @
2d39527c
...
@@ -932,7 +932,7 @@ class GpuDownsampleFactorMaxGrad(GpuOp):
...
@@ -932,7 +932,7 @@ class GpuDownsampleFactorMaxGrad(GpuOp):
return
Apply
(
self
,
[
x
,
z
,
gz
],
[
x
.
type
()])
return
Apply
(
self
,
[
x
,
z
,
gz
],
[
x
.
type
()])
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
7
,)
return
(
8
,)
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
x
,
z
,
gz
=
inp
x
,
z
,
gz
=
inp
...
@@ -1056,6 +1056,7 @@ class GpuDownsampleFactorMaxGrad(GpuOp):
...
@@ -1056,6 +1056,7 @@ class GpuDownsampleFactorMaxGrad(GpuOp):
// Cast threadIdx.x into a signed int, to avoid problems with
// Cast threadIdx.x into a signed int, to avoid problems with
// indexing with negative offsets.
// indexing with negative offsets.
int tx = threadIdx.x;
int tx = threadIdx.x;
int bx = blockDim.x;
for(int i0 = blockIdx.x;
for(int i0 = blockIdx.x;
i0 < D0;
i0 < D0;
...
@@ -1075,20 +1076,20 @@ class GpuDownsampleFactorMaxGrad(GpuOp):
...
@@ -1075,20 +1076,20 @@ class GpuDownsampleFactorMaxGrad(GpuOp):
for (i1 = 0; i1 < D1; ++i1) // loop over images (same for z and x)
for (i1 = 0; i1 < D1; ++i1) // loop over images (same for z and x)
{
{
for(int col_iter = 0;
for(int col_iter = 0;
col_iter * blockDim.x <= xD3
; col_iter++){
(tx + col_iter * bx < xD3)
; col_iter++){
//The if inside is to don't do the division if we
//The if inside is to don't do the division if we
// need only 1 col_iter
// need only 1 col_iter
if(
blockDim.x !=
xD3)
if(
tx + bx <
xD3)
{
{
x_col = tx + col_iter * b
lockDim.
x;
x_col = tx + col_iter * bx;
z_col = x_col/ds1;
z_col = x_col/ds1;
}
}
if (
%(ignore_border)
s &&
x_col >= ds1 * D3
)
if (
%(ignore_border)
s &&
((x_col >= ds1 * D3) || (i2 >= D2))
)
{
{
// This happens only if x_col was ignored
// This happens only if x_col was ignored
, or if i2*ds0 was
// (via ignore_border)
// (via ignore_border)
// TODO: if ignore_border is False, this is impossible
// TODO: if ignore_border is False, this is impossible
// and we don't even need to generate this code.
// and we don't even need to generate this code.
...
@@ -1109,18 +1110,16 @@ class GpuDownsampleFactorMaxGrad(GpuOp):
...
@@ -1109,18 +1110,16 @@ class GpuDownsampleFactorMaxGrad(GpuOp):
my_z = z[i0 * zS0 + i1 * zS1 + i2 * zS2 +
my_z = z[i0 * zS0 + i1 * zS1 + i2 * zS2 +
z_col* zS3];
z_col* zS3];
}
}
if(x_col<xD3){
for (int x_row = i2*ds0;
for (int x_row = i2*ds0;
(x_row < i2*ds0+ds0) && (x_row < xD2); ++x_row)
(x_row < i2*ds0+ds0) && (x_row < xD2); ++x_row)
{
{
// this is effectively:
// this is effectively:
// gx[image_row][image_col][x_row][x_col]
// gx[image_row][image_col][x_row][x_col]
// = (my_z == x[image_row][image_col][
// = (my_z == x[image_row][image_col][
// x_row][x_col]) ? my_gz : 0.0f;
// x_row][x_col]) ? my_gz : 0.0f;
gx[i0*gxS0 + i1*gxS1 + x_row*gxS2 + x_col*gxS3]
gx[i0*gxS0 + i1*gxS1 + x_row*gxS2 + x_col*gxS3]
= (my_z == x[i0*xS0 + i1*xS1 + x_row*xS2 +
= (my_z == x[i0*xS0 + i1*xS1 + x_row*xS2 +
x_col*xS3]) ? my_gz : 0.0f;
x_col*xS3]) ? my_gz : 0.0f;
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论