Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Convert remaining code to pybind11#28856

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
greglucas merged 8 commits intomatplotlib:mainfromQuLogic:pybind11-finals
Oct 8, 2024
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Don't enforce trailing shape on empty arrays
They need only be the same number of dimensions, as sometimes code does`np.atleast_3d(array)` on something empty, which inserts the 0-dimensionin a spot that messes with the expected trailing shape.
  • Loading branch information
@QuLogic
QuLogic committedOct 2, 2024
commit086add18d724fb1ba7d25767938b2c78f72975e4
10 changes: 10 additions & 0 deletionssrc/mplutils.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -77,6 +77,11 @@ inline bool check_trailing_shape(T array, char const* name, long d1)
array.ndim());
return false;
}
if (array.size() == 0) {
// Sometimes things come through as atleast_2d, etc., but they're empty, so
// don't bother enforcing the trailing shape.
return true;
}
if (array.shape(1) != d1) {
PyErr_Format(PyExc_ValueError,
"%s must have shape (N, %ld), got (%ld, %ld)",
Expand All@@ -95,6 +100,11 @@ inline bool check_trailing_shape(T array, char const* name, long d1, long d2)
array.ndim());
return false;
}
if (array.size() == 0) {
// Sometimes things come through as atleast_3d, etc., but they're empty, so
// don't bother enforcing the trailing shape.
return true;
}
if (array.shape(1) != d1 || array.shape(2) != d2) {
PyErr_Format(PyExc_ValueError,
"%s must have shape (N, %ld, %ld), got (%ld, %ld, %ld)",
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp