Skip to content

Conversation

justinchuby
Copy link
Collaborator

This happens in some of the LORA models. When we use ReduceL1/ReduceL2 or when ord is an even number, we don't need to take Abs of the input

Signed-off-by: Justin Chu justinchuby@users.noreply.github.com

This happens in some of the LORA models. When we use ReduceL1/ReduceL2 or when ord is an even number, we don't need to take Abs of the input

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@justinchuby justinchuby added the module: torchlib Related to the torch/aten function lib in development label Sep 23, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the aten_linalg_vector_norm function by selectively applying the absolute value operation only when necessary, based on the order parameter. The change removes redundant Abs operations for even-order norms and built-in reduction operations.

  • Moves the Abs operation from being applied unconditionally to being conditionally applied based on the norm order
  • Adds logic to only apply Abs for negative orders, odd orders, or infinite orders
  • Maintains existing behavior for ReduceL1, ReduceL2, and even-order norms without unnecessary absolute value computation

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.09%. Comparing base (f54cf47) to head (5a8e7ee).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2570   +/-   ##
=======================================
  Coverage   70.09%   70.09%           
=======================================
  Files         222      222           
  Lines       26182    26184    +2     
  Branches     2580     2581    +1     
=======================================
+ Hits        18351    18353    +2     
  Misses       6931     6931           
  Partials      900      900           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@justinchuby justinchuby enabled auto-merge (squash) September 23, 2025 19:32
@justinchuby justinchuby merged commit e67eeef into main Sep 23, 2025
32 checks passed
@justinchuby justinchuby deleted the justinchu/simplify-linalg_vector_norm branch September 23, 2025 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: torchlib Related to the torch/aten function lib in development
Projects
Development

Successfully merging this pull request may close these issues.

2 participants