Skip to content

simplify reshapes#217

Merged
ekzhu merged 4 commits intoekzhu:masterfrom
chris-ha458:reshape
Sep 2, 2023
Merged

simplify reshapes#217
ekzhu merged 4 commits intoekzhu:masterfrom
chris-ha458:reshape

Conversation

@chris-ha458
Copy link
Copy Markdown
Contributor

This arguably makes the code easier to read, and reduces one transpose .T operation.

the ndmin=2 is required for the transpose to be valid.

@ekzhu
Copy link
Copy Markdown
Owner

ekzhu commented Aug 30, 2023

This arguably makes the code easier to read, and reduces one transpose .T operation.

the ndmin=2 is required for the transpose to be valid.

Thanks for the PR. Could you also add a guard rail in this function (or in init) to prevent cases when number of bands is less than 2?

@chris-ha458
Copy link
Copy Markdown
Contributor Author

I think putting it in the init would be better to avoid putting a branch in hot code.
However, in that case, should we just assert out when bands < 2( ==1)?

@ekzhu
Copy link
Copy Markdown
Owner

ekzhu commented Aug 31, 2023

Contributor

Raise value error so caller knows what's wrong.

@chris-ha458
Copy link
Copy Markdown
Contributor Author

Is this inline with what you had in mind?

@ekzhu ekzhu merged commit d24c983 into ekzhu:master Sep 2, 2023
@ekzhu
Copy link
Copy Markdown
Owner

ekzhu commented Sep 2, 2023

Is this inline with what you had in mind?

Yes.

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