-
Notifications
You must be signed in to change notification settings - Fork 92
Description
Describe the bug
The derivative tests in test_spline.py and test_spline_surface.py occasionally fail. This is not due to an issue in the spline implementation but to a logical flaw in the tests themselves.
The spline order ranges from 1 to 8, which means the underlying polynomial degree ranges from 0 to 7. When the tests compare derivatives against values computed via automatic differentiation, they sometimes attempt to compute a second derivative of a degree-0 polynomial (a constant). PyTorch’s autograd (called by our grad) returns None for the derivative of a constant, and taking a second derivative of that value raises a TypeError (“NoneType is not subscriptable”).
In short: the tests incorrectly assume that higher-order derivatives always exist, but autograd cannot compute second derivatives of constants, leading to sporadic failures.
To reproduce
Modify, for instance, test_spline_surface.py to force the order to be always 1 (degree 0):
orders = [random.randint(1, 1) for _ in range(2)]