Skip to content

Conversation

@PrimedErwin
Copy link
Collaborator

The current version supports:

  • CI/CD check, csv report automatic generation
  • Broadcasting mechanism
  • Operators: add, div, matmul, max, min, mean, mul, mulf, pow, reciprocal, square, sub, sum. Both forward and backward operations are supported. sum, mean, min, max can take an extra argument to reduce the specific dimension like pytorch.
  • nn functional: linear, relu
  • A small nn example in ./src2/main.c

Advaitgaur004 and others added 30 commits May 25, 2025 19:18
- Minor Change is made test_pytorch_ref.c file so that it works with current ci, as string matching from the artificat take place and hence it should be exact same.

- check_all_results.py is changed to sorted output for consistent ordering

-run-tests.yml is also slightly changed to as in the Windows job, the path to the executable is incorrect, which is rectified

- LOCALLY TESTED
- Add, matmul, mean, mul, mulf, sub, sum
…r partipular operator under particular subtest category
Add Test Suite for cTensor
Advaitgaur004 and others added 29 commits July 3, 2025 20:42
- Once the reduced dimension is found, we "unsqueeze" the upstream gradient (e.g., from {2} to {2, 1}), making it ready for broadcasting. This is a clean, zero-copy operation that solves the shape mismatch elegantly.
- fixed a bug in GradFn_mean where it was incorrectly calculating the gradient value based on the output tensor's size instead of the input's

- It now correctly computes the 1/N gradient.
- Else block(fallback) This code runs when:
for scalar input only Logically.

Example : Scalar Input
Input tensor: shape [1] (1 element)
Output tensor: shape [1] (1 element)
Again, input_ndim (1) == output_ndim (1)
divisor = 1
Fix: Stabilize Backpropagation for Sum and Mean
- Tensor_reduce_with_indices is initially added in the early development, but later on it is simply redudant.
Add: autograd support for min and max tensor operations
- 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
[FIX] Broadcasting in division and power operations with tests
@PrimedErwin PrimedErwin merged commit 29d32fb into main Jul 13, 2025
5 checks passed
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.

3 participants