Skip to content

Commit 3d3f3be

Browse files
committed
Add and test doctest-modules
1 parent 5d2b757 commit 3d3f3be

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ versionfile_build = "pytensor/_version.py"
116116
tag_prefix = "rel-"
117117

118118
[tool.pytest]
119-
addopts = "--durations=50"
119+
addopts = "--durations=50 --doctest-modules"
120120
testpaths = "tests/"
121121

122122
[tool.ruff]

pytensor/gradient.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,13 +2086,13 @@ def hessian_vector_product(cost, wrt, p, **grad_kwargs):
20862086
20872087
from pytensor import function
20882088
from pytensor.tensor import vector
2089-
from pytensor.gradient import jacobian, hessian_vector_product
2089+
from pytensor.gradient import grad, hessian_vector_product
20902090
20912091
x = vector('x')
20922092
p = vector('p')
20932093
20942094
rosen = (100 * (x[1:] - x[:-1] ** 2) ** 2 + (1 - x[:-1]) ** 2).sum()
2095-
rosen_jac = jacobian(rosen, x)
2095+
rosen_jac = grad(rosen, x)
20962096
rosen_hessp = hessian_vector_product(rosen, x, p)
20972097
20982098
rosen_fn = function([x], rosen)
@@ -2107,6 +2107,7 @@ def hessian_vector_product(cost, wrt, p, **grad_kwargs):
21072107
hessp=rosen_hessp_fn,
21082108
options={"xtol": 1e-8},
21092109
)
2110+
assert 0
21102111
assert res.success
21112112
np.testing.assert_allclose(res.x, np.ones_like(x0))
21122113

0 commit comments

Comments
 (0)