-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
Description
This was found during #1754
It seems to go a while back. At some point I get issues with grad expecting it to be disconnected. Very odd:
import numpy as np
import pytensor.tensor as pt
from pytensor import function, scan
x = pt.scalar("x")
# xs[-1] is equivalent to x ** 16
xs, _ = scan(
fn=lambda xtm1: xtm1**2,
outputs_info=[x],
n_steps=5,
)
r = xs[-1]
ggg = pt.grad(pt.grad(pt.grad(r, x), x), x)
fn = function([x], ggg, mode="FAST_RUN")
np.testing.assert_allclose(fn(0.95), (16 * 15 * 14) * 0.95 ** 13)
# AssertionError:
# Not equal to tolerance rtol=1e-07, atol=0
# Mismatched elements: 1 / 1 (100%)
# Max absolute difference among violations: 18446.6957
# Max relative difference among violations: 10.69479434
# ACTUAL: array(20171.5251)
# DESIRED: array(1724.8294)Metadata
Metadata
Assignees
Labels
No labels