Skip to content

Commit

Permalink
Update ch15_part1.py
Browse files Browse the repository at this point in the history
for loop not following mathematical formula
elfelround authored Apr 28, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 5d63c16 commit cc3d11f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch15/ch15_part1.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit cc3d11f

Please sign in to comment.