File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 2222
2323import numpy as np
2424
25- from aesara .graph .basic import Constant , Variable
25+ from aesara .graph .basic import Variable
2626from aesara .tensor .var import TensorVariable
2727from typing_extensions import TypeAlias
2828
@@ -618,4 +618,4 @@ def find_size(
618618
619619def rv_size_is_none (size : Variable ) -> bool :
620620 """Check wether an rv size is None (ie., at.Constant([]))"""
621- return isinstance ( size , Constant ) and size . data . size == 0
621+ return size . type . shape == ( 0 ,)
Original file line number Diff line number Diff line change @@ -133,6 +133,9 @@ def test_rv_size_is_none():
133133 rv = Normal .dist (0 , 1 , size = None )
134134 assert rv_size_is_none (rv .owner .inputs [1 ])
135135
136+ rv = Normal .dist (0 , 1 , size = ())
137+ assert rv_size_is_none (rv .owner .inputs [1 ])
138+
136139 rv = Normal .dist (0 , 1 , size = 1 )
137140 assert not rv_size_is_none (rv .owner .inputs [1 ])
138141
You can’t perform that action at this time.
0 commit comments