@@ -3873,9 +3873,10 @@ class Interpolated(BoundedContinuous):
3873
3873
Parameters
3874
3874
----------
3875
3875
x_points: array-like
3876
- A monotonically growing list of values
3876
+ A monotonically growing list of values. Must be non-symbolic
3877
3877
pdf_points: array-like
3878
- Probability density function evaluated on lattice ``x_points``
3878
+ Probability density function evaluated on lattice ``x_points``. Must
3879
+ be non-symbolic
3879
3880
"""
3880
3881
3881
3882
rv_op = interpolated
@@ -3889,9 +3890,9 @@ def dist(cls, x_points, pdf_points, *args, **kwargs):
3889
3890
cdf_points = interp .antiderivative ()(x_points ) / Z
3890
3891
pdf_points = pdf_points / Z
3891
3892
3892
- x_points = at .as_tensor_variable (floatX (x_points ))
3893
- pdf_points = at .as_tensor_variable (floatX (pdf_points ))
3894
- cdf_points = at .as_tensor_variable (floatX (cdf_points ))
3893
+ x_points = at .constant (floatX (x_points ))
3894
+ pdf_points = at .constant (floatX (pdf_points ))
3895
+ cdf_points = at .constant (floatX (cdf_points ))
3895
3896
3896
3897
# lower = at.as_tensor_variable(x_points[0])
3897
3898
# upper = at.as_tensor_variable(x_points[-1])
@@ -3913,11 +3914,14 @@ def logp(value, x_points, pdf_points, cdf_points):
3913
3914
-------
3914
3915
TensorVariable
3915
3916
"""
3917
+ # x_points and pdf_points are expected to be non-symbolic arrays wrapped
3918
+ # within a tensor.constant. We use the .data method to retrieve them
3916
3919
interp = InterpolatedUnivariateSpline (x_points .data , pdf_points .data , k = 1 , ext = "zeros" )
3917
- interp_op = SplineWrapper (interp )
3918
-
3919
3920
Z = interp .integral (x_points .data [0 ], x_points .data [- 1 ])
3920
- Z = at .as_tensor_variable (Z )
3921
+
3922
+ # interp and Z are converted to symbolic variables here
3923
+ interp_op = SplineWrapper (interp )
3924
+ Z = at .constant (Z )
3921
3925
3922
3926
return at .log (interp_op (value ) / Z )
3923
3927
0 commit comments