Skip to content

Fix wrong axis in conv-layer finite-difference formulas#2716

Open
Chessing234 wants to merge 1 commit into
d2l-ai:masterfrom
Chessing234:fix/conv-layer-horizontal-finite-difference
Open

Fix wrong axis in conv-layer finite-difference formulas#2716
Chessing234 wants to merge 1 commit into
d2l-ai:masterfrom
Chessing234:fix/conv-layer-horizontal-finite-difference

Conversation

@Chessing234

Copy link
Copy Markdown

Summary

  • The [1, -1] edge kernel is 1×2 and applied along the width axis, so at (i, j) it computes X[i,j] - X[i,j+1].
  • The prose correctly calls this a horizontal finite difference, but the formulas on the same line used the vertical axis (x_{i,j} - x_{(i+1),j} and \partial_i).

Root cause

Row index i and column index j were swapped in the symbolic expressions.

Why this fix is correct

The code block right below (K = [[1.0, -1.0]]) already implements a horizontal difference; only the math notation was wrong.

Fixes #2669

Made with Cursor

The [1, -1] kernel is 1×2 and runs along columns, so the difference is horizontal (j), not vertical (i).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

conv-layer.ipynb

1 participant