Skip to content

Conversation

@5hv5hvnk
Copy link
Member

this is another PR for #5417 which I got closed because of deletion of my forked repo

convert_size wrongly assumes symbolic sizes have to be scalars

import pymc as pm
import aesara.tensor as at

s = at.scalar('s')
size = at.stack([s, s])
x = at.random.normal(size=size)
x.eval({s: 2})
# array([[-0.66285345,  0.97341598],
#        [ 0.05158132,  2.03399059]])

pm.Normal.dist(size=size)
# ValueError: The `size` parameter must be a tuple, TensorVariable, int or list. Actual: <class 'aesara.tensor.var.TensorVariable'>

fixed by changing code in

if isinstance(size, int) or (isinstance(size, TensorVariable) and size.ndim == 0):

by accepting size.ndim == 1 as well as size.ndim == 0

Closes #5394

@5hv5hvnk
Copy link
Member Author

@twiecki @michaeloriordan please have a look

Copy link
Member

@michaelosthege michaelosthege left a comment

Choose a reason for hiding this comment

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

Good call, @5hv5hvnk to just make a new PR.

Please address thecomments & run the pre-commit before I trigger the CI

@5hv5hvnk 5hv5hvnk requested a review from michaelosthege March 16, 2022 13:25
@codecov
Copy link

codecov bot commented Mar 16, 2022

Codecov Report

Merging #5601 (6163ca6) into main (09bddde) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5601      +/-   ##
==========================================
+ Coverage   87.57%   87.60%   +0.03%     
==========================================
  Files          76       76              
  Lines       13741    13745       +4     
==========================================
+ Hits        12033    12041       +8     
+ Misses       1708     1704       -4     
Impacted Files Coverage Δ
pymc/distributions/shape_utils.py 97.07% <100.00%> (+0.07%) ⬆️
pymc/parallel_sampling.py 87.70% <0.00%> (+1.32%) ⬆️

@5hv5hvnk
Copy link
Member Author

This failed Arviz compatibility checks, I manually updated Arviz but can't commit because there are no changes in any of the files, how can I fix this?

@michaelosthege
Copy link
Member

This failed Arviz compatibility checks, I manually updated Arviz but can't commit because there are no changes in any of the files, how can I fix this?

This is a rather new problem in our CI pipeline. I think I know how to fix it.
I'll check out your branch and add the fix. Otherwise your changes look fine and I'm optimistic that we can merge it if my CI fix works.

@michaelosthege
Copy link
Member

I force-pushed your branch after squashing your two commits.
This way we can do a rebase-merge that'll add these two logically distinct commits to our main branch.

However, it looks like GitHub Actions is currently down (https://githubstatus.com).
Let's see when it comes back and if the CI works out this time.

Your PR is most likely the next one that'll get merged 👍

The non-SSL cloning is no longer supported by GitHub.
@michaelosthege michaelosthege merged commit 07f5847 into pymc-devs:main Mar 17, 2022
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.

convert_size wrongly assumes symbolic sizes have to be scalars

2 participants