Skip to content

Commit 2a324bc

Browse files
ricardoV94twiecki
authored andcommitted
Bump Pytensor dependency
1 parent 5d68bf3 commit 2a324bc

13 files changed

+69
-69
lines changed

conda-envs/environment-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- numpy>=1.15.0
1515
- pandas>=0.24.0
1616
- pip
17-
- pytensor=2.10.1
17+
- pytensor>=2.11.0,<2.12
1818
- python-graphviz
1919
- networkx
2020
- scipy>=1.4.1

conda-envs/environment-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
- numpy>=1.15.0
1313
- pandas>=0.24.0
1414
- pip
15-
- pytensor=2.9.1
15+
- pytensor>=2.11.0,<2.12
1616
- python-graphviz
1717
- scipy>=1.4.1
1818
- typing-extensions>=3.7.4

conda-envs/environment-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
- numpy>=1.15.0
1818
- pandas>=0.24.0
1919
- pip
20-
- pytensor=2.10.1
20+
- pytensor>=2.11.0,<2.12
2121
- python-graphviz
2222
- networkx
2323
- scipy>=1.4.1

conda-envs/windows-environment-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- numpy>=1.15.0
1515
- pandas>=0.24.0
1616
- pip
17-
- pytensor=2.10.1
17+
- pytensor>=2.11.0,<2.12
1818
- python-graphviz
1919
- networkx
2020
- scipy>=1.4.1

conda-envs/windows-environment-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
- numpy>=1.15.0
1818
- pandas>=0.24.0
1919
- pip
20-
- pytensor=2.10.1
20+
- pytensor>=2.11.0,<2.12
2121
- python-graphviz
2222
- networkx
2323
- scipy>=1.4.1

pymc/distributions/continuous.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def get_tau_sigma(tau=None, sigma=None):
235235
else:
236236
if isinstance(sigma, Variable):
237237
# Keep tau negative, if sigma was negative, so that it will fail when used
238-
tau = (sigma**-2.0) * pt.sgn(sigma)
238+
tau = (sigma**-2.0) * pt.sign(sigma)
239239
else:
240240
sigma_ = np.asarray(sigma)
241241
if np.any(sigma_ <= 0):
@@ -248,7 +248,7 @@ def get_tau_sigma(tau=None, sigma=None):
248248
else:
249249
if isinstance(tau, Variable):
250250
# Keep sigma negative, if tau was negative, so that it will fail when used
251-
sigma = pt.abs(tau) ** (-0.5) * pt.sgn(tau)
251+
sigma = pt.abs(tau) ** (-0.5) * pt.sign(tau)
252252
else:
253253
tau_ = np.asarray(tau)
254254
if np.any(tau_ <= 0):

pymc/distributions/dist_math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def impl(self, x):
370370
def grad(self, inp, grads):
371371
(x,) = inp
372372
(gz,) = grads
373-
return (gz * (i1e_scalar(x) - pytensor.scalar.sgn(x) * i0e_scalar(x)),)
373+
return (gz * (i1e_scalar(x) - pytensor.scalar.sign(x) * i0e_scalar(x)),)
374374

375375

376376
i0e_scalar = I0e(upgrade_to_float_no_complex, name="i0e")

pymc/distributions/multivariate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,8 +2059,8 @@ def make_node(self, rng, size, dtype, mu, W, alpha, tau):
20592059
sparse = isinstance(W, pytensor.sparse.SparseVariable)
20602060
msg = "W must be a symmetric adjacency matrix."
20612061
if sparse:
2062-
abs_diff = pytensor.sparse.basic.mul(pytensor.sparse.basic.sgn(W - W.T), W - W.T)
2063-
W = Assert(msg)(W, pt.isclose(pytensor.sparse.basic.sp_sum(abs_diff), 0))
2062+
abs_diff = pytensor.sparse.basic.mul(pytensor.sparse.sign(W - W.T), W - W.T)
2063+
W = Assert(msg)(W, pt.isclose(pytensor.sparse.sp_sum(abs_diff), 0))
20642064
else:
20652065
W = Assert(msg)(W, pt.allclose(W, W.T))
20662066

pymc/logprob/transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def find_measurable_transforms(fgraph: FunctionGraph, node: Node) -> Optional[Li
608608
return None
609609
try:
610610
(power,) = other_inputs
611-
power = pt.get_scalar_constant_value(power).item()
611+
power = pt.get_underlying_scalar_constant_value(power).item()
612612
# Power needs to be a constant
613613
except NotScalarConstantError:
614614
return None

pymc/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ def make_obs_var(
14431443
# values, and another for the non-missing values.
14441444

14451445
antimask_idx = (~mask).nonzero()
1446-
nonmissing_data = pt.as_tensor_variable(data[antimask_idx])
1446+
nonmissing_data = pt.as_tensor_variable(data[antimask_idx].data)
14471447
unmasked_rv_var = rv_var[antimask_idx]
14481448
unmasked_rv_var = unmasked_rv_var.owner.clone().default_output()
14491449

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ numpydoc
1818
pandas>=0.24.0
1919
polyagamma
2020
pre-commit>=2.8.0
21-
pytensor==2.10.1
21+
pytensor>=2.11.0,<2.12
2222
pytest-cov>=2.5
2323
pytest>=3.0
2424
scipy>=1.4.1

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ cloudpickle
44
fastprogress>=0.2.0
55
numpy>=1.15.0
66
pandas>=0.24.0
7-
pytensor==2.10.1
7+
pytensor>=2.11.0,<2.12
88
scipy>=1.4.1
99
typing-extensions>=3.7.4

tests/test_printing.py

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -132,63 +132,63 @@ def setup_class(self):
132132
self.formats = [("plain", True), ("plain", False), ("latex", True), ("latex", False)]
133133
self.expected = {
134134
("plain", True): [
135-
r"alpha ~ N(0, 10)",
136-
r"sigma ~ N**+(0, 1)",
135+
r"alpha ~ Normal(0, 10)",
136+
r"sigma ~ HalfNormal(0, 1)",
137137
r"mu ~ Deterministic(f(beta, alpha))",
138-
r"beta ~ N(0, 10)",
139-
r"Z ~ N(f(), f())",
140-
r"nb_with_p_n ~ NB(10, nbp)",
141-
r"zip ~ MarginalMixture(f(), DiracDelta(0), Pois(5))",
142-
r"w ~ Dir(<constant>)",
138+
r"beta ~ Normal(0, 10)",
139+
r"Z ~ MultivariateNormal(f(), f())",
140+
r"nb_with_p_n ~ NegativeBinomial(10, nbp)",
141+
r"zip ~ MarginalMixture(f(), DiracDelta(0), Poisson(5))",
142+
r"w ~ Dirichlet(<constant>)",
143143
(
144144
r"nested_mix ~ MarginalMixture(w, "
145-
r"MarginalMixture(f(), DiracDelta(0), Pois(5)), "
146-
r"Censored(Bern(0.5), -1, 1))"
145+
r"MarginalMixture(f(), DiracDelta(0), Poisson(5)), "
146+
r"Censored(Bernoulli(0.5), -1, 1))"
147147
),
148-
r"Y_obs ~ N(mu, sigma)",
148+
r"Y_obs ~ Normal(mu, sigma)",
149149
r"pot ~ Potential(f(beta, alpha))",
150150
],
151151
("plain", False): [
152-
r"alpha ~ N",
153-
r"sigma ~ N**+",
152+
r"alpha ~ Normal",
153+
r"sigma ~ HalfNormal",
154154
r"mu ~ Deterministic",
155-
r"beta ~ N",
156-
r"Z ~ N",
157-
r"nb_with_p_n ~ NB",
155+
r"beta ~ Normal",
156+
r"Z ~ MultivariateNormal",
157+
r"nb_with_p_n ~ NegativeBinomial",
158158
r"zip ~ MarginalMixture",
159-
r"w ~ Dir",
159+
r"w ~ Dirichlet",
160160
r"nested_mix ~ MarginalMixture",
161-
r"Y_obs ~ N",
161+
r"Y_obs ~ Normal",
162162
r"pot ~ Potential",
163163
],
164164
("latex", True): [
165-
r"$\text{alpha} \sim \operatorname{N}(0,~10)$",
166-
r"$\text{sigma} \sim \operatorname{N^{+}}(0,~1)$",
165+
r"$\text{alpha} \sim \operatorname{Normal}(0,~10)$",
166+
r"$\text{sigma} \sim \operatorname{HalfNormal}(0,~1)$",
167167
r"$\text{mu} \sim \operatorname{Deterministic}(f(\text{beta},~\text{alpha}))$",
168-
r"$\text{beta} \sim \operatorname{N}(0,~10)$",
169-
r"$\text{Z} \sim \operatorname{N}(f(),~f())$",
170-
r"$\text{nb_with_p_n} \sim \operatorname{NB}(10,~\text{nbp})$",
171-
r"$\text{zip} \sim \operatorname{MarginalMixture}(f(),~\operatorname{DiracDelta}(0),~\operatorname{Pois}(5))$",
172-
r"$\text{w} \sim \operatorname{Dir}(\text{<constant>})$",
168+
r"$\text{beta} \sim \operatorname{Normal}(0,~10)$",
169+
r"$\text{Z} \sim \operatorname{MultivariateNormal}(f(),~f())$",
170+
r"$\text{nb_with_p_n} \sim \operatorname{NegativeBinomial}(10,~\text{nbp})$",
171+
r"$\text{zip} \sim \operatorname{MarginalMixture}(f(),~\operatorname{DiracDelta}(0),~\operatorname{Poisson}(5))$",
172+
r"$\text{w} \sim \operatorname{Dirichlet}(\text{<constant>})$",
173173
(
174174
r"$\text{nested_mix} \sim \operatorname{MarginalMixture}(\text{w},"
175-
r"~\operatorname{MarginalMixture}(f(),~\operatorname{DiracDelta}(0),~\operatorname{Pois}(5)),"
176-
r"~\operatorname{Censored}(\operatorname{Bern}(0.5),~-1,~1))$"
175+
r"~\operatorname{MarginalMixture}(f(),~\operatorname{DiracDelta}(0),~\operatorname{Poisson}(5)),"
176+
r"~\operatorname{Censored}(\operatorname{Bernoulli}(0.5),~-1,~1))$"
177177
),
178-
r"$\text{Y_obs} \sim \operatorname{N}(\text{mu},~\text{sigma})$",
178+
r"$\text{Y_obs} \sim \operatorname{Normal}(\text{mu},~\text{sigma})$",
179179
r"$\text{pot} \sim \operatorname{Potential}(f(\text{beta},~\text{alpha}))$",
180180
],
181181
("latex", False): [
182-
r"$\text{alpha} \sim \operatorname{N}$",
183-
r"$\text{sigma} \sim \operatorname{N^{+}}$",
182+
r"$\text{alpha} \sim \operatorname{Normal}$",
183+
r"$\text{sigma} \sim \operatorname{HalfNormal}$",
184184
r"$\text{mu} \sim \operatorname{Deterministic}$",
185-
r"$\text{beta} \sim \operatorname{N}$",
186-
r"$\text{Z} \sim \operatorname{N}$",
187-
r"$\text{nb_with_p_n} \sim \operatorname{NB}$",
185+
r"$\text{beta} \sim \operatorname{Normal}$",
186+
r"$\text{Z} \sim \operatorname{MultivariateNormal}$",
187+
r"$\text{nb_with_p_n} \sim \operatorname{NegativeBinomial}$",
188188
r"$\text{zip} \sim \operatorname{MarginalMixture}$",
189-
r"$\text{w} \sim \operatorname{Dir}$",
189+
r"$\text{w} \sim \operatorname{Dirichlet}$",
190190
r"$\text{nested_mix} \sim \operatorname{MarginalMixture}$",
191-
r"$\text{Y_obs} \sim \operatorname{N}$",
191+
r"$\text{Y_obs} \sim \operatorname{Normal}$",
192192
r"$\text{pot} \sim \operatorname{Potential}$",
193193
],
194194
}
@@ -210,28 +210,28 @@ def setup_class(self):
210210
self.formats = [("plain", True), ("plain", False), ("latex", True), ("latex", False)]
211211
self.expected = {
212212
("plain", True): [
213-
r"a ~ N(2, 1)",
214-
r"b ~ N(<shared>, 1)",
215-
r"c ~ N(2, 1)",
216-
r"d ~ N(<constant>, 1)",
213+
r"a ~ Normal(2, 1)",
214+
r"b ~ Normal(<shared>, 1)",
215+
r"c ~ Normal(2, 1)",
216+
r"d ~ Normal(<constant>, 1)",
217217
],
218218
("plain", False): [
219-
r"a ~ N",
220-
r"b ~ N",
221-
r"c ~ N",
222-
r"d ~ N",
219+
r"a ~ Normal",
220+
r"b ~ Normal",
221+
r"c ~ Normal",
222+
r"d ~ Normal",
223223
],
224224
("latex", True): [
225-
r"$\text{a} \sim \operatorname{N}(2,~1)$",
226-
r"$\text{b} \sim \operatorname{N}(\text{<shared>},~1)$",
227-
r"$\text{c} \sim \operatorname{N}(2,~1)$",
228-
r"$\text{d} \sim \operatorname{N}(\text{<constant>},~1)$",
225+
r"$\text{a} \sim \operatorname{Normal}(2,~1)$",
226+
r"$\text{b} \sim \operatorname{Normal}(\text{<shared>},~1)$",
227+
r"$\text{c} \sim \operatorname{Normal}(2,~1)$",
228+
r"$\text{d} \sim \operatorname{Normal}(\text{<constant>},~1)$",
229229
],
230230
("latex", False): [
231-
r"$\text{a} \sim \operatorname{N}$",
232-
r"$\text{b} \sim \operatorname{N}$",
233-
r"$\text{c} \sim \operatorname{N}$",
234-
r"$\text{d} \sim \operatorname{N}$",
231+
r"$\text{a} \sim \operatorname{Normal}$",
232+
r"$\text{b} \sim \operatorname{Normal}$",
233+
r"$\text{c} \sim \operatorname{Normal}$",
234+
r"$\text{d} \sim \operatorname{Normal}$",
235235
],
236236
}
237237

@@ -249,9 +249,9 @@ def test_model_latex_repr_three_levels_model():
249249
expected = [
250250
"$$",
251251
"\\begin{array}{rcl}",
252-
"\\text{mu} &\\sim & \\operatorname{N}(0,~5)\\\\\\text{sigma} &\\sim & "
253-
"\\operatorname{C^{+}}(0,~2.5)\\\\\\text{censored_normal} &\\sim & "
254-
"\\operatorname{Censored}(\\operatorname{N}(\\text{mu},~\\text{sigma}),~-2,~2)",
252+
"\\text{mu} &\\sim & \\operatorname{Normal}(0,~5)\\\\\\text{sigma} &\\sim & "
253+
"\\operatorname{HalfCauchy}(0,~2.5)\\\\\\text{censored_normal} &\\sim & "
254+
"\\operatorname{Censored}(\\operatorname{Normal}(\\text{mu},~\\text{sigma}),~-2,~2)",
255255
"\\end{array}",
256256
"$$",
257257
]
@@ -268,8 +268,8 @@ def test_model_latex_repr_mixture_model():
268268
"$$",
269269
"\\begin{array}{rcl}",
270270
"\\text{w} &\\sim & "
271-
"\\operatorname{Dir}(\\text{<constant>})\\\\\\text{mix} &\\sim & "
272-
"\\operatorname{MarginalMixture}(\\text{w},~\\operatorname{N}(0,~5),~\\operatorname{StudentT}(7,~0,~1))",
271+
"\\operatorname{Dirichlet}(\\text{<constant>})\\\\\\text{mix} &\\sim & "
272+
"\\operatorname{MarginalMixture}(\\text{w},~\\operatorname{Normal}(0,~5),~\\operatorname{StudentT}(7,~0,~1))",
273273
"\\end{array}",
274274
"$$",
275275
]

0 commit comments

Comments
 (0)