Skip to content

fix(autojac): Replace unsafe use of view with reshape#582

Merged
ValerianRey merged 2 commits intoSimplexLab:mainfrom
DJKorchinski:fix-jac-view-reshape
Feb 19, 2026
Merged

fix(autojac): Replace unsafe use of view with reshape#582
ValerianRey merged 2 commits intoSimplexLab:mainfrom
DJKorchinski:fix-jac-view-reshape

Conversation

@DJKorchinski
Copy link
Contributor

I could not find a way to produce non-contiguous tensors as the output of the gradient_vector.split(...) call, but I've added the safer .reshape nonetheless. I also added a test to make sure that non-contiguous jacobians are safely handled.

@PierreQuinton
Copy link
Contributor

PierreQuinton commented Feb 19, 2026

Thanks a lot for the PR!

I don't think it is possible to have a non continuous gradient here, but I can't be sure so this is very good! The test is nice, but I'll let @ValerianRey review it, I think it would be nice to run it while changing reshape to view in _unite_jacobians to see if this fails as excpected.

@PierreQuinton PierreQuinton added package: autojac cc: fix Conventional commit type for bug fixes of the actual library (changes to src). labels Feb 19, 2026
@DJKorchinski
Copy link
Contributor Author

DJKorchinski commented Feb 19, 2026 via email

@PierreQuinton PierreQuinton changed the title Fix potential issue with .view on noncontiguous memory and added tests fix(autojac): Replace unsafe use of view with reshape Feb 19, 2026
Copy link
Contributor

@PierreQuinton PierreQuinton left a comment

Choose a reason for hiding this comment

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

Fantastic, LGTM then. Congratulation on the first PR (maybe we still wait on @ValerianRey just in case he had something in mind)

Copy link
Contributor

@ValerianRey ValerianRey left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the contribution!

@ValerianRey ValerianRey merged commit aeef2f4 into SimplexLab:main Feb 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: fix Conventional commit type for bug fixes of the actual library (changes to src). package: autojac

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments