Bugfixes for Model crashes when some inputs are scalars.#11548
Conversation
|
Hello @WilliamJamieson 👋! It looks like you've made some changes in your pull request, so I've checked the code again for style. There are no PEP8 style issues with this pull request - thanks! 🎉 Comment last updated at 2021-04-27 14:47:34 UTC |
|
Does this also fix #9953 ? |
|
Does this also supersede #10362 ? |
|
Tagging @mcara. |
|
All I can say is that I am happy my example, which was previously crashing, is now passing unit tests. So it seems to fix my issue. Thanks @WilliamJamieson ! |
perrygreenfield
left a comment
There was a problem hiding this comment.
LGTM. When reviewing prepare_inputs and prepare_outputs variants I always have trouble following what the products of one are. For example, I would not guess that format_info actually is related to broadcast shapes, and I always waste time figuring that stuff out again. At some point in the future some better outline of explaining how all that works ought to help make it easier to make changes and review code.
I agree, at some point we need to refactor so that the shaping that is going on in |
Added tests to show that issue astropy#10170 is fixed. Added `towncrier` change log. Fixed codestyle check by adding specific exceptions to check. Possible fixes for issue astropy#11360. More investigation is necessary. Cleaned up last bugfix. Updated change log entry. Added tests for astropy#11360 fixes. Fixed whitespace Fix for jwst and gwcs test failures. Added testing for issue causing fails in jwst and gwcs Fixed a typo. Added some of astropy#10362 tests Changes in astropy#10362 to pass new tests Code cleanup More code cleanup Added additional testing from astropy#10362 Possible fix for issue astropy#11060. Added test to show astropy#11060 has been fixed Fixed failing test under no-scipy Added future warning ignore to newest test Modified tabular so that both inputs in issue astropy#11060 produce same output
0064f51 to
a9b67fb
Compare
Sorry to have come very late to this, but I think this statement is wrong but, more importantly, it prevents Consider the model The problem here is that it means but I can do Clearly this is wrong. |
|
Oh, no. Do we have to revert this patch? |
|
Let's discuss at #12021 |
Description
This provides bugfixes for model crashes when some inputs are scalars (or smaller array which can broadcast to larger array). The main issue occurs when an earlier (in input order) input is a smaller array which must be broadcast to be compatible with a larger array. This issue occurs because the output should be the shape of the larger array, but
_prepare_outputs_single_modelattempts to reshape the array to fit into the first input's shape. In reality, the outputs should be reshaped to the broadcast shape of all the input arrays. This is what has been implemented here, along side tests verifying that the issue has been fixed.Also adds fixes to allow outputs to be correctly reshaped without crashing in other circumstances.
Fixes #10170, Fixes #11360, Fixes #9953, and Fixes #11060.
Closes #10362