Skip to content

Commit

Permalink
Merge pull request rasbt#125 from elfelround/patch-3
Browse files Browse the repository at this point in the history
for loop fix to follow math formula
  • Loading branch information
rasbt authored May 5, 2020
2 parents a19b19c + 15f171f commit f4bb301
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ch15/ch15_part1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
" x_padded = np.concatenate(\n",
" [zero_pad, x_padded, zero_pad])\n",
" res = []\n",
" for i in range(0, int(len(x)/s),s):\n",
" for i in range(0, int((len(x_padded) - len(w_rot)) / s) + 1, s):\n",
" res.append(np.sum(\n",
" x_padded[i:i+w_rot.shape[0]] * w_rot))\n",
" return np.array(res)\n",
Expand Down
2 changes: 1 addition & 1 deletion ch15/ch15_part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def conv1d(x, w, p=0, s=1):
x_padded = np.concatenate(
[zero_pad, x_padded, zero_pad])
res = []
for i in range(0, int(len(x)/s),s):
for i in range(0, int((len(x_padded) - len(w_rot)) / s) + 1, s):
res.append(np.sum(
x_padded[i:i+w_rot.shape[0]] * w_rot))
return np.array(res)
Expand Down

0 comments on commit f4bb301

Please sign in to comment.