Expand description
Dispatch table for the torch fit entry — single source of truth for which
Python Smooth subclasses the torch.fit autograd glue recognises.
The Python side calls torch_smooth_dispatch_key(type(smooth).__name__)
to translate the spec class name into a small enumeration. The tensor
construction itself stays in Python because the torch autograd VJP must
flow back through points, centers, and by.
Every Python Smooth subclass that is re-exported from gamfit.torch
must have a matching variant here, so that dispatch never fails for a
class the user can legitimately import. TensorBSpline (te tensor
product), Matern (kernel-Gram penalty), and Categorical (sum-to-zero
contrast with an identity ridge penalty — an i.i.d. Gaussian random
effect, matching the Rust RandomEffectTermSpec) are now all fully wired
on the torch path. Every exported variant resolves to a fit.py branch
that builds a concrete (design, penalty) tensor pair.
Enums§
Functions§
- dispatch_
key - Map a Python
Smoothsubclass name to the matching torch entry kind.