Skip to content

Commit

Permalink
Update channels.md
Browse files Browse the repository at this point in the history
要遍历第0个维度,如果直接zip(X, K)的话,corr2d()依次读取到X和K的第0和1个维度,对X[i]中的两个矩阵和K[i]中的两个矩阵进行卷积运算,这样会导致出现'''ValueError: too many values to unpack (expected 2)'''这样的错误,因此,要对X和K加上下标0
  • Loading branch information
Wjbbbbb authored Sep 17, 2024
1 parent e6b18cc commit 0eab8ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chapter_convolutional-neural-networks/channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import paddle
#@tab mxnet, pytorch, paddle
def corr2d_multi_in(X, K):
# 先遍历“X”和“K”的第0个维度(通道维度),再把它们加在一起
return sum(d2l.corr2d(x, k) for x, k in zip(X, K))
return sum(d2l.corr2d(x, k) for x, k in zip(X[0], K[0]))
```

```{.python .input}
Expand Down

0 comments on commit 0eab8ea

Please sign in to comment.