xnn.common.models.constants#
Model constants that stay exact in float64.
Some values of a model are fixed by its configuration but computed when a block
is built, in the default dtype of that moment, and kept as buffers (so most are
in the state_dict): Clebsch-Gordan (Wigner-3j) tensors and the bases built from
them, radial frequencies, distance-transform and screening constants, the
energy scale and shift. A model built in float32 and cast to float64, or loaded
from a float32 checkpoint, would carry them float32-rounded, which caps its
float64 agreement with an exact evaluation (near 1e-10 for the coupling tensors,
1e-7 for the radial frequencies). exact_float64_constants() rebuilds every
float64 one exactly as a float64 build would make it, and the models that
carry such constants (through ExactFloat64Constants, the Equiformers)
call it after every cast and every load_state_dict. Float32 values are left as built:
their rounding is below float32 arithmetic.
Functions
|
|
|
Make the float64 constants of |
|
Register |
|
Copy |
Classes
|
Mixin for a model whose float64 constants stay exact through casts and loads. |