Skip to content

Handle invalid BroadcastTo shape in C backend #175

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

Merged
merged 1 commit into from
Jan 8, 2023

Conversation

ricardoV94
Copy link
Member

Closes #152

@ricardoV94 ricardoV94 added bug Something isn't working C-backend labels Jan 5, 2023
@ricardoV94 ricardoV94 requested a review from lucianopaz January 5, 2023 16:06
@ricardoV94 ricardoV94 changed the title Handle incorrect BroadcastTo shape in C code Handle invalid BroadcastTo shape in C code Jan 5, 2023
@ricardoV94 ricardoV94 marked this pull request as ready for review January 5, 2023 16:06
@ricardoV94 ricardoV94 changed the title Handle invalid BroadcastTo shape in C code Handle invalid BroadcastTo shape in C backend Jan 5, 2023
Copy link
Member

@lucianopaz lucianopaz left a comment

Choose a reason for hiding this comment

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

Looks good @ricardoV94. I left three comments

@ricardoV94 ricardoV94 force-pushed the broadcast_to_check branch 2 times, most recently from 8be1bf8 to 3c43f0a Compare January 6, 2023 11:07
@@ -1313,7 +1333,7 @@ def test_memory_leak(self):
blocks_last = blocks_i

tracemalloc.stop()
assert np.allclose(np.mean(block_diffs), 0)
assert np.mean(block_diffs) <= (0 + 1e-8)
Copy link
Member Author

@ricardoV94 ricardoV94 Jan 6, 2023

Choose a reason for hiding this comment

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

This was failing with negative values, which should not be problematic (?). No idea what the function does when it raises.

@ricardoV94 ricardoV94 requested a review from lucianopaz January 6, 2023 13:20
Copy link
Member

@lucianopaz lucianopaz left a comment

Choose a reason for hiding this comment

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

LGTM @ricardoV94. I don't know what do make out of the performance regression. I doesn't seem related to this PR but I can't seem to find a way to get the detailed benchmark results from the cache or from this PR.

@ricardoV94
Copy link
Member Author

The last cached benchmark might have been a CI fluke and this one looks bad in comparison?

Only the C scan test could possibly have been affected so I'll run it locally before and after the changes to see if it complains.

@lucianopaz
Copy link
Member

Looks like the performance regression problems are happening because the tests that use random are not being seeded, and different seeds can lead to very different run times

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C-backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: pytensor.tensor.random.utils.params_broadcast_shapes does not raise errors when shapes do not broadcast
2 participants