Skip to content

Fix: Correct gradient calculation in division operation#1

Open
ProfiDE wants to merge 1 commit into
babelyian:mainfrom
ProfiDE:fix/division-gradient-bug
Open

Fix: Correct gradient calculation in division operation#1
ProfiDE wants to merge 1 commit into
babelyian:mainfrom
ProfiDE:fix/division-gradient-bug

Conversation

@ProfiDE

@ProfiDE ProfiDE commented Jun 16, 2026

Copy link
Copy Markdown

The derivative of x/y with respect to y is -x/y², but the implementation
was missing the negative sign, causing incorrect gradient propagation
during backpropagation.

Changes:

  • Added negative sign to other.grad calculation
  • Simplified expression using direct division instead of exponent
  • Improved readability with explicit derivative formulas

Fixes incorrect gradient flow in division operations.

The derivative of x/y with respect to y is -x/y², but the implementation
was missing the negative sign, causing incorrect gradient propagation
during backpropagation.

Changes:
- Added negative sign to other.grad calculation
- Simplified expression using direct division instead of exponent
- Improved readability with explicit derivative formulas

Fixes incorrect gradient flow in division operations.
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.

1 participant