Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sptensor tutorial indexing #174

Merged
merged 15 commits into from
Jul 6, 2023

Conversation

ntjohnson1
Copy link
Collaborator

@ntjohnson1 ntjohnson1 commented Jul 2, 2023

This PR is all scope creep. I've been battling indexing for a while and had been meaning to do a larger scale refactor to make things more obvious. I finally had some bandwidth for this but I think there is more to do related to simplifying and unifying code in setitem for sptensor and tensor (getitem for both tensors now shares more common logic). That will be another day.

As far as I am aware this should resolve:

I broke out the different pieces by commit so it might be easier to review that way for motivation of individual changes then look at the resulting product as a whole to decide if there is anything else we'd like to change. In my opinion grouping the tests into test classes with smaller simpler test methods makes it clearer WHY we have certain indexing tests and where updated tests should go if we find more edge cases.

Some of the work here overlaps pretty strongly with the effort to add typing over all of pyttb. There are quite a few tests in our unit tests to exercise a bunch of different type combinations that I believe mypy should be able to statically validate/point out issues with as well continue our coverage.

Also for test_subtensor_assign_oddity I believe this is a bug in upstream MATLAB tensortoolbox since it doesn't really make sense. I'd prefer to land this PR then think about it some more/open a PR to MATLAB for clarification.

* Our subscripts approach was still broken
* Handling indexing for a single dim tensor required some nuance
* Add verbosity to error instead of DEBUG_test flag
* We don't really use pytest markers so prune them from tests I am touching
* Group indexing tests into test calss for logical separation
* Make tests smaller/more focussed in scope
* Caught a bug in subtensor assignement sizes
* Small fix around int vs np int check (broader typing issue outside scope here)
* Group indexing tests into test class for logical separation
* Make tests smaller/more focussed in scope
* Small fix around int vs np int check (broader typing issue outside scope here)
* Fix some type confusion in ktensor
* Move some special casing to unified helper method
@ntjohnson1 ntjohnson1 marked this pull request as ready for review July 2, 2023 19:46
@ntjohnson1 ntjohnson1 requested a review from dmdunla July 2, 2023 19:46
This was referenced Jul 3, 2023
@DeepBlockDeepak
Copy link
Collaborator

Your updates work nicely with the sptensor tutorial's TODOS!

DeepBlockDeepak pushed a commit to DeepBlockDeepak/pyttb that referenced this pull request Jul 3, 2023
…till needs to be cleaned in separate feature branch for the associated separate PR.
@dmdunla
Copy link
Collaborator

dmdunla commented Jul 6, 2023

I'll submit an issue to discuss the example in test_sptensor.py/test_subtensor_assign_oddity

@dmdunla dmdunla merged commit 302e403 into sandialabs:main Jul 6, 2023
@ntjohnson1 ntjohnson1 deleted the sptensor_tutorial_indexing branch July 6, 2023 15:06
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