Handle non-constant NoneTypeT variables#1728
Conversation
| dist_params, | ||
| self.ndims_params, | ||
| size_length=None if NoneConst.equals(size) else get_vector_length(size), | ||
| size_length=None |
There was a problem hiding this comment.
here size is already a PyTensor variable for sure
| if shape is None: | ||
| return NoneConst | ||
| elif isinstance(shape, int): | ||
| if isinstance(shape, Variable) and isinstance(shape.type, NoneTypeT): |
There was a problem hiding this comment.
Some functions that happen before conversion of python types to PyTensor variables must first check we have a Variable before we can try to check it's .type
72196a3 to
4f81d27
Compare
|
Only flaky CI is failing: #1729 |
4f81d27 to
c193d5c
Compare
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (95.00%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1728 +/- ##
========================================
Coverage 81.70% 81.71%
========================================
Files 246 251 +5
Lines 53632 54112 +480
Branches 9438 9470 +32
========================================
+ Hits 43822 44215 +393
- Misses 7329 7409 +80
- Partials 2481 2488 +7
🚀 New features to boost your workflow:
|
lucianopaz
left a comment
There was a problem hiding this comment.
This looks good to me. Thanks @ricardoV94
Fixes pymc-devs/pymc#7901
NoneType is a bit of an odd one. It can ever only have one value at runtime: None, so there is no much point in having it be symbolic. But sometimes it can be in the normal use of PyTensor, such as when creating OpFromGraph around RVs automatically. That was the problem in the related issue.
This PR changes all checks to be one the NoneTypeT of the variable, so it works regardless of whether it is a Constant or not.