Skip to content

Conversation

@Advaitgaur004
Copy link
Contributor

I've fixed the broadcasting implementation in the division and power operations, similar to our previous fix for the multiplication operation. I've also added backwards tests for both operations to ensure they're working correctly.

- Refactored GradFn_div and GradFn_pow to handle broadcasting correctly with modulo indexing
- Preserved original tensors in Tensor_div and Tensor_pow before broadcasting
- Fixed gradient computation in both operations to work with tensors of different shapes
- Simplified gradient function implementation by reusing result tensor
- Fixed power operation's gradient calculation to use cached result instead of recalculating
@Advaitgaur004 Advaitgaur004 changed the title Fix broadcasting in division and power operations with tests [FIX] Broadcasting in division and power operations with tests Jul 8, 2025
@PrimedErwin PrimedErwin merged commit 80ca8c8 into pocketpy:test Jul 8, 2025
5 checks passed
@Advaitgaur004 Advaitgaur004 deleted the backward-4 branch July 19, 2025 05:53
@Advaitgaur004 Advaitgaur004 changed the title [FIX] Broadcasting in division and power operations with tests [Fix] : Broadcasting in division and power operations with tests Aug 20, 2025
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.

2 participants