File tree 4 files changed +11
-7
lines changed 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 69
69
get_slice_elements ,
70
70
set_subtensor ,
71
71
)
72
- from pytensor .tensor .var import TensorConstant , get_unique_value
72
+ from pytensor .tensor .var import TensorConstant , get_unique_constant_value
73
73
74
74
75
75
list_opt_slice = [
@@ -136,7 +136,7 @@ def remove_constants_and_unused_inputs_scan(fgraph, node):
136
136
node_inp = node .inputs [idx + 1 ]
137
137
if (
138
138
isinstance (node_inp , TensorConstant )
139
- and get_unique_value (node_inp ) is not None
139
+ and get_unique_constant_value (node_inp ) is not None
140
140
):
141
141
try :
142
142
# This works if input is a constant that has all entries
Original file line number Diff line number Diff line change 62
62
uint_dtypes ,
63
63
values_eq_approx_always_true ,
64
64
)
65
- from pytensor .tensor .var import TensorConstant , TensorVariable , get_unique_value
65
+ from pytensor .tensor .var import (
66
+ TensorConstant ,
67
+ TensorVariable ,
68
+ get_unique_constant_value ,
69
+ )
66
70
67
71
68
72
if TYPE_CHECKING :
@@ -323,7 +327,7 @@ def get_underlying_scalar_constant_value(
323
327
raise NotScalarConstantError ()
324
328
325
329
if isinstance (v , Constant ):
326
- unique_value = get_unique_value (v )
330
+ unique_value = get_unique_constant_value (v )
327
331
if unique_value is not None :
328
332
data = unique_value
329
333
else :
Original file line number Diff line number Diff line change 101
101
values_eq_approx_remove_inf_nan ,
102
102
values_eq_approx_remove_nan ,
103
103
)
104
- from pytensor .tensor .var import TensorConstant , get_unique_value
104
+ from pytensor .tensor .var import TensorConstant , get_unique_constant_value
105
105
106
106
107
107
def scalarconsts_rest (inputs , elemwise = True , only_process_constants = False ):
@@ -133,7 +133,7 @@ def get_constant(v):
133
133
134
134
"""
135
135
if isinstance (v , Constant ):
136
- unique_value = get_unique_value (v )
136
+ unique_value = get_unique_constant_value (v )
137
137
if unique_value is not None :
138
138
data = unique_value
139
139
else :
Original file line number Diff line number Diff line change @@ -986,7 +986,7 @@ def no_nan(self):
986
986
return self ._no_nan
987
987
988
988
989
- def get_unique_value (x : TensorVariable ) -> Optional [Number ]:
989
+ def get_unique_constant_value (x : TensorVariable ) -> Optional [Number ]:
990
990
"""Return the unique value of a tensor, if there is one"""
991
991
if isinstance (x , Constant ):
992
992
data = x .data
You can’t perform that action at this time.
0 commit comments