Skip to content

Commit afcdd2a

Browse files
committed
[Fix] fix some bugs
1 parent d220217 commit afcdd2a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/09_optimize_reduce/01_interleaved_addressing/reduce_interleaved_addressing.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ __global__ void reduce_naive_kernel(int *arr, int *out, int len)
2525
for (int s = 1; s < bdim; s *= 2)
2626
{
2727
int index = 2 * s * tid;
28-
if ((index + s < bdim) && (bdim * bid + s < len))
28+
if ((index + s < bdim) && (bdim * bid + s + index < len))
2929
{
3030
sdata[index] += sdata[index + s];
3131
}
@@ -98,4 +98,4 @@ int main()
9898
delete[] arr;
9999
delete[] out;
100100
return 0;
101-
}
101+
}

docs/12_convolution/02_intro_conv_optimize/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## 1. 卷积算法映射为矩阵乘法
88

9-
首先我们先来回顾一下卷积算法的定义,假设输入的特征图为 $X$,卷积核为 $K$,输出特征图为 $Y$,$X$ 的大小为 $N \times C \times H \times W$,$K$ 的大小为 $M \times C \times K_h \times K_w$,$Y$ 的大小为 $N \times M \times H \times W$。那么卷积算法的定义如下:
9+
首先我们先来回顾一下卷积算法的定义,假设输入的特征图为 $X$,卷积核为 $K$,输出特征图为 $Y$,$X$ 的大小为 $N \times C_{in} \times H_{in} \times W_{in}$,$K$ 的大小为 $M \times C_{in} \times K_h \times K_w$,$Y$ 的大小为 $N \times M \times H_{out} \times W_{out}$。那么卷积算法的定义如下:
1010

1111
$$
1212
Y[n,oc,oh,ow] = \sum_{ic}\sum_{fh}\sum_{fw}X[n,ic,ih,iw] \times K[oc,ic,fh,fw]

0 commit comments

Comments
 (0)